raylu 5 months ago
parent
commit
cc2976517e
2 changed files with 29 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 28 0
      install_extras.py

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 /bk
 /buildifier
+/curlie
 /dua
 /dust
 /eza

+ 28 - 0
install_extras.py

@@ -15,6 +15,7 @@ CURRENT_DIR = pathlib.Path(__file__).parent
 
 def main():
 	bat()
+	curlie()
 	delta()
 	dua()
 	dust()
@@ -42,6 +43,33 @@ def bat():
 
 	subprocess.run(['sudo', 'apt', 'install', 'bat', '--yes'], check=True)
 
+def curlie():
+	if platform.system() == 'Darwin':
+		print('$ brew install curlie')
+		subprocess.run(['brew', 'install', 'curlie'], check=True)
+		return
+
+	if subprocess.run(['dpkg', '-l', 'curlie'], stdout=subprocess.DEVNULL).returncode == 0:
+		print_gray('curlie package already installed')
+		return
+
+	client = httpx.Client()
+	latest = gh_latest_version(client, 'rs', 'curlie')
+
+	version = latest['tag_name'].removeprefix('v')
+	system = platform.system().lower()
+	arch = get_output(['dpkg', '--print-architecture'])
+	filename = f'curlie_{version}_{system}_{arch}.deb'
+
+	(asset,) = (asset for asset in latest['assets'] if asset['name'] == filename)
+	deb_path = CURRENT_DIR / 'curlie.deb'
+	download(client, asset['browser_download_url'], deb_path)
+
+	try:
+		subprocess.run(['sudo', 'dpkg', '-i', deb_path], check=True)
+	finally:
+		os.unlink(deb_path)
+
 def delta():
 	if platform.system() == 'Darwin':
 		print('$ brew install git-delta')