raylu 4 weeks ago
parent
commit
a7009284ff
2 changed files with 31 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 30 0
      install_extras.py

+ 1 - 0
.gitignore

@@ -8,6 +8,7 @@
 /fx
 /git-whence
 /jj
+/jjui
 /lazygit
 /oh-my-posh
 /procs

+ 30 - 0
install_extras.py

@@ -30,6 +30,7 @@ def main():
 	eza()
 	fx()
 	git_whence()
+	jjui()
 	jujutsu()
 	lazygit()
 	oh_my_posh()
@@ -240,6 +241,35 @@ def git_whence():
 	download(client, url, CURRENT_DIR / 'git-whence')
 	os.chmod(CURRENT_DIR / 'git-whence', 0o755)
 
+def jjui():
+	if (CURRENT_DIR / 'jjui').exists():
+		print_gray('jjui already downloaded')
+		return
+
+	if platform.system() == 'Darwin':
+		print('$ brew install jjui')
+		subprocess.run(['brew', 'install', 'jjui'], check=True)
+		return
+	else:
+		assert platform.system() == 'Linux'
+
+	client = httpx.Client()
+	latest = gh_latest_version(client, 'idursun', 'jjui')
+	version = latest['name']
+
+	system = platform.system().lower()
+	arch = platform.machine()
+	name = f'jjui-{version}-{arch}-{system}'
+	url = f'https://github.com/idursun/jjui/releases/download/{version}/{name}.zip'
+	zip_path = CURRENT_DIR / 'jjui.zip'
+	download(client, url, zip_path)
+	with zipfile.ZipFile(zip_path, 'r') as zipf:
+		extracted = (CURRENT_DIR / 'jjui')
+		with zipf.open(name, 'r') as binary, extracted.open('wb') as f:
+			shutil.copyfileobj(binary, f)
+		extracted.chmod(0o755)
+	zip_path.unlink()
+
 def jujutsu():
 	if (CURRENT_DIR / 'jj').exists():
 		print_gray('jj already downloaded')