raylu 4 сар өмнө
parent
commit
947c32b26f
2 өөрчлөгдсөн 22 нэмэгдсэн , 0 устгасан
  1. 1 0
      .gitignore
  2. 21 0
      install_extras.py

+ 1 - 0
.gitignore

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

+ 21 - 0
install_extras.py

@@ -15,6 +15,7 @@ CURRENT_DIR = pathlib.Path(__file__).parent
 
 def main():
 	bat()
+	choose()
 	curlie()
 	delta()
 	dua()
@@ -44,6 +45,26 @@ def bat():
 
 	subprocess.run(['sudo', 'apt', 'install', 'bat', '--yes'], check=True)
 
+def choose():
+	if platform.system() == 'Darwin':
+		print('$ brew install choose-rust')
+		subprocess.run(['brew', 'install', 'choose-rust'], check=True)
+		return
+	else:
+		assert platform.system() == 'Linux'
+
+	if (CURRENT_DIR / 'choose').exists():
+		print_gray('choose already downloaded')
+		return
+
+	client = httpx.Client()
+	arch = platform.machine()
+	if arch == 'arm64':
+		arch = 'aarch64'
+	url = f'https://github.com/theryangeary/choose/releases/latest/download/choose-{arch}-unknown-linux-gnu'
+	download(client, url, CURRENT_DIR / 'choose')
+	os.chmod(CURRENT_DIR / 'choose', 0o755)
+
 def curlie():
 	if platform.system() == 'Darwin':
 		print('$ brew install curlie')