Skip to content

Instantly share code, notes, and snippets.

@Eveeifyeve
Last active August 10, 2024 13:26
Show Gist options
  • Save Eveeifyeve/ab9eedfacc1ba996a28b9de2694206ca to your computer and use it in GitHub Desktop.
Save Eveeifyeve/ab9eedfacc1ba996a28b9de2694206ca to your computer and use it in GitHub Desktop.
reinstallAppsPyScrpt
cmake
bun
gh
gradle
jenv
neovide
neovim
raycast
spicetify-cli
tmux
wezterm
import subprocess
from concurrent.futures import ThreadPoolExecutor
# Function to read apps from a text file
def read_apps_from_file(filename):
with open(filename, 'r') as file:
apps = [line.strip() for line in file]
return apps
# Read the list of applications from a text file
apps = read_apps_from_file('apps.txt')
def install_app(formula_name):
try:
subprocess.check_call(['brew', 'update'])
result = subprocess.run(['brew', 'install', formula_name], capture_output=True, text=True)
if "already installed" in result.stdout:
return True
else:
return True
except subprocess.CalledProcessError as e:
return False
def is_cask(formula_name):
try:
casks = subprocess.check_output(['brew', 'list', '--casks'], text=True).splitlines()
return formula_name in casks
except subprocess.CalledProcessError:
return False
def check_homebrew():
subprocess.check_call(['brew', '--version'])
def main:
for formula_name in apps:
if install_app(formula_name):
# Skip casting if the app is a cask
if not is_cask(formula_name):
# print(f"\033[31mCasting is not supported for {formula_name}.\033[0m")
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment