StyleSync-AI / install_gh.py
Pathakkunal's picture
Deploy: StyleSync AI Phase 5 (Fixes Applied)
0fc3485
import shutil
import subprocess
import sys
def main():
# Check Status
gh_path = shutil.which('gh')
if not gh_path:
# Install
print("GitHub CLI not found. Installing via winget...")
try:
subprocess.run(['winget', 'install', '--id', 'GitHub.cli', '-e'], check=True)
except subprocess.CalledProcessError as e:
print(f"Error installing GitHub CLI: {e}")
return
except FileNotFoundError:
print("Error: 'winget' command not found. Please ensure App Installer is installed.")
return
# Post-Install Instructions (Runs if installed or if installation succeeded)
print("\n" + "="*40)
try:
# Attempt to use ANSI codes for bold, may not work in all Windows terminals but works in VS Code / modern Windows Terminal
print("โœ… \033[1mGitHub CLI is ready!\033[0m")
except:
print("โœ… GitHub CLI is ready!")
print("="*40)
print("โš ๏ธ IMPORTANT: You must now restart your terminal to reload your PATH.")
print("๐Ÿ‘‰ After restarting, run this command to log in: gh auth login")
if __name__ == "__main__":
main()