Spaces:
Sleeping
Sleeping
Download install_gh.py from Bhishaj/MerchFlow-AI: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/Bhishaj/MerchFlow-AI/resolve/06e46fc04efab07fa5629577233f9308ff9fe061/install_gh.py
- Command line
-
hf download hf://spaces/Bhishaj/MerchFlow-AI@06e46fc04efab07fa5629577233f9308ff9fe061/install_gh.py
-
curl -L -o install_gh.py https://huggingface.co/spaces/Bhishaj/MerchFlow-AI/resolve/06e46fc04efab07fa5629577233f9308ff9fe061/install_gh.py
1.19 kB
| 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() | |