gitpush-tool 0.2.9__tar.gz → 0.2.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Supercharged Git push tool with automatic GitHub repo creation and pushing
5
5
  Home-page: https://github.com/inevitablegs/gitpush
6
6
  Author: Ganesh Sonawane
@@ -20,22 +20,6 @@ A supercharged Git CLI tool that simplifies repository creation and pushing with
20
20
  pip install gitpush-tool
21
21
  ```
22
22
 
23
- ### Prerequisites
24
-
25
- - GitHub CLI (gh)
26
- - Git
27
-
28
- ```bash
29
- # Install GitHub CLI
30
- # macOS
31
- brew install gh
32
-
33
- # Windows
34
- winget install --id GitHub.cli
35
-
36
- # Linux (Debian/Ubuntu)
37
- sudo apt install gh
38
- ```
39
23
 
40
24
  ## Usage 🛠️
41
25
 
@@ -179,4 +163,4 @@ Contributions welcome! Please follow these steps:
179
163
 
180
164
  MIT - See LICENSE for details.
181
165
 
182
- <center>✨ <strong>Happy Coding!</strong> ✨</center>
166
+ <center>✨ <strong>Happy Coding!</strong> ✨</center>
@@ -0,0 +1 @@
1
+ __version__ = "0.2.10"
@@ -4,98 +4,60 @@ import sys
4
4
  import subprocess
5
5
  import shutil
6
6
  import platform
7
- import urllib.request
8
- import tempfile
9
- import json
10
-
11
- def install_gh_cli_windows():
12
- """Install GitHub CLI on Windows using winget or direct download"""
13
- # Try winget first
14
- if shutil.which("winget"):
15
- try:
16
- print("📦 Attempting to install GitHub CLI with winget...")
17
- subprocess.run(["winget", "install", "--id", "GitHub.cli", "--source", "winget", "--silent"], check=True, capture_output=True)
18
- print("✅ GitHub CLI installed successfully via winget.")
19
- return True
20
- except (subprocess.CalledProcessError, FileNotFoundError):
21
- print("⚠️ Winget installation failed. Falling back to direct download.")
22
-
23
- # Fallback to direct download
24
- try:
25
- print("⬇️ Finding the latest GitHub CLI release for Windows...")
26
- api_url = "https://api.github.com/repos/cli/cli/releases/latest"
27
- with urllib.request.urlopen(api_url) as response:
28
- data = json.loads(response.read().decode())
29
-
30
- msi_url = next((asset["browser_download_url"] for asset in data.get("assets", []) if asset.get("name", "").endswith("_windows_amd64.msi")), None)
31
-
32
- if not msi_url:
33
- print("❌ Could not find a downloadable MSI file for the latest release.", file=sys.stderr)
34
- return False
35
-
36
- msi_path = os.path.join(tempfile.gettempdir(), "gh_installer.msi")
37
-
38
- print(f"⬇️ Downloading GitHub CLI from: {msi_url}")
39
- urllib.request.urlretrieve(msi_url, msi_path)
40
-
41
- print("🛠️ Installing GitHub CLI...")
42
- subprocess.run(["msiexec", "/i", msi_path, "/quiet", "/norestart"], check=True)
43
-
44
- os.remove(msi_path)
45
- print("✅ GitHub CLI installed successfully.")
46
- return True
47
- except Exception as e:
48
- print(f"❌ Direct installation failed: {e}", file=sys.stderr)
49
- return False
50
7
 
51
8
  def check_gh_installed():
52
- """Check if GitHub CLI is installed. If not, prompt the user to install it."""
9
+ """
10
+ Checks if GitHub CLI is installed. If not, it provides a comprehensive list
11
+ of platform-specific installation commands and fallbacks.
12
+ """
53
13
  if shutil.which("gh"):
54
14
  return True
55
15
 
56
- print(" GitHub CLI (gh) is required for the '--new-repo' feature but was not found.", file=sys.stderr)
57
- try:
58
- answer = input(" Would you like this tool to attempt an automatic installation? (y/n): ").lower().strip()
59
- except (EOFError, KeyboardInterrupt):
60
- print("\nInstallation cancelled.", file=sys.stderr)
61
- return False
62
-
63
- if answer != 'y':
64
- print("➡️ Installation skipped. Please install 'gh' manually from https://cli.github.com/", file=sys.stderr)
65
- return False
16
+ print(" Error: GitHub CLI (gh) is not installed or not in your system's PATH.", file=sys.stderr)
17
+ print(" The '--new-repo' feature requires the GitHub CLI for all repository operations.", file=sys.stderr)
66
18
 
67
- print("\n📦 Attempting to install GitHub CLI...")
68
19
  system = platform.system()
69
- installed = False
20
+ install_options = []
21
+
22
+ # --- Platform-specific detection with fallbacks ---
23
+ if system == "Windows":
24
+ print("\n➡️ For Windows, we recommend one of the following package managers:", file=sys.stderr)
25
+ if shutil.which("winget"):
26
+ install_options.append(("Winget (Recommended)", "winget install --id GitHub.cli --source winget"))
27
+ if shutil.which("scoop"):
28
+ install_options.append(("Scoop", "scoop install gh"))
29
+ if shutil.which("choco"):
30
+ install_options.append(("Chocolatey", "choco install gh"))
70
31
 
71
- try:
72
- if system == "Windows":
73
- installed = install_gh_cli_windows()
74
- elif system == "Darwin":
75
- print(" Running: brew install gh")
76
- subprocess.run(["brew", "install", "gh"], check=True)
77
- installed = True
78
- elif system == "Linux":
79
- print(" Running: sudo apt update && sudo apt install -y gh")
80
- subprocess.run(["sudo", "apt", "update"], check=True)
81
- subprocess.run(["sudo", "apt", "install", "-y", "gh"], check=True)
82
- installed = True
83
- else:
84
- print(f"❌ Automatic installation is not supported for your OS ({system}).", file=sys.stderr)
85
- print(" Please install 'gh' manually from https://cli.github.com/", file=sys.stderr)
86
- return False
32
+ elif system == "Darwin":
33
+ print("\n➡️ For macOS, we recommend using Homebrew:", file=sys.stderr)
34
+ if shutil.which("brew"):
35
+ install_options.append(("Homebrew (Recommended)", "brew install gh"))
87
36
 
88
- except (subprocess.CalledProcessError, FileNotFoundError) as e:
89
- print(f" Installation failed: {e}", file=sys.stderr)
90
- print(" Please try installing 'gh' manually from https://cli.github.com/", file=sys.stderr)
91
- return False
37
+ elif system == "Linux":
38
+ print("\n➡️ For Linux, we recommend one of the following package managers:", file=sys.stderr)
39
+ if shutil.which("apt") or shutil.which("apt-get"):
40
+ install_options.append(("Debian/Ubuntu/Mint", "sudo apt update && sudo apt install gh -y"))
41
+ if shutil.which("dnf"):
42
+ install_options.append(("Fedora/RHEL/CentOS", "sudo dnf install gh"))
43
+ if shutil.which("yum"):
44
+ install_options.append(("Older Fedora/RHEL/CentOS", "sudo yum install gh"))
45
+ if shutil.which("pacman"):
46
+ install_options.append(("Arch Linux", "sudo pacman -S github-cli"))
47
+ if shutil.which("zypper"):
48
+ install_options.append(("openSUSE", "sudo zypper install gh"))
92
49
 
93
- if installed:
94
- print("\n✅ GitHub CLI was installed successfully!", file=sys.stderr)
95
- print("‼️ IMPORTANT: You must open a NEW terminal for the changes to take effect.", file=sys.stderr)
96
- print(" Please re-run your command in a new terminal window.", file=sys.stderr)
97
- sys.exit(0) # Exit gracefully so the user can follow instructions
50
+ # --- Displaying the options and the ultimate fallback ---
51
+ if install_options:
52
+ print(" Please copy and run one of the commands below in your terminal:\n", file=sys.stderr)
53
+ for name, command in install_options:
54
+ print(f" # For {name}:\n {command}\n", file=sys.stderr)
98
55
 
56
+ print(" If none of the above are available on your system, please follow the", file=sys.stderr)
57
+ print(" official installation guide for more options (including manual download):", file=sys.stderr)
58
+ print(" https://github.com/cli/cli#installation\n", file=sys.stderr)
59
+ print("‼️ After installation, please open a NEW terminal and run your command again.", file=sys.stderr)
60
+
99
61
  return False
100
62
 
101
63
  def gh_authenticated():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Supercharged Git push tool with automatic GitHub repo creation and pushing
5
5
  Home-page: https://github.com/inevitablegs/gitpush
6
6
  Author: Ganesh Sonawane
@@ -6,7 +6,7 @@ long_description = (Path(__file__).parent / "LONG_DESCRIPTION.md").read_text(enc
6
6
 
7
7
  setup(
8
8
  name="gitpush-tool",
9
- version="0.2.9",
9
+ version="0.2.10",
10
10
  packages=find_packages(),
11
11
  install_requires=[],
12
12
  entry_points={
@@ -1 +0,0 @@
1
- __version__ = "0.2.9"
File without changes
File without changes
File without changes