codefetch-cli 1.2.6__tar.gz → 1.2.7__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.
- {codefetch_cli-1.2.6/codefetch_cli.egg-info → codefetch_cli-1.2.7}/PKG-INFO +1 -1
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch/__init__.py +1 -1
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch/cli.py +62 -26
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7/codefetch_cli.egg-info}/PKG-INFO +1 -1
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/pyproject.toml +1 -1
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/setup.py +1 -1
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/LICENSE +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/README.md +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch_cli.egg-info/SOURCES.txt +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch_cli.egg-info/dependency_links.txt +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch_cli.egg-info/entry_points.txt +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/codefetch_cli.egg-info/top_level.txt +0 -0
- {codefetch_cli-1.2.6 → codefetch_cli-1.2.7}/setup.cfg +0 -0
|
@@ -18,7 +18,7 @@ DEFAULT_REPO = None
|
|
|
18
18
|
|
|
19
19
|
CONFIG_FILE = Path.home() / ".codefetch.json"
|
|
20
20
|
|
|
21
|
-
__version__ = "1.2.
|
|
21
|
+
__version__ = "1.2.7"
|
|
22
22
|
|
|
23
23
|
# Supported code, data, and config extensions
|
|
24
24
|
CODE_EXTENSIONS = {
|
|
@@ -641,7 +641,7 @@ def fetch_file(filename, owner=None, repo=None, branch=None,
|
|
|
641
641
|
|
|
642
642
|
|
|
643
643
|
def parse_version_tuple(v_str):
|
|
644
|
-
"""Parse version string like '1.2.
|
|
644
|
+
"""Parse version string like '1.2.7' into a comparable tuple of integers."""
|
|
645
645
|
try:
|
|
646
646
|
return tuple(int(x) for x in re.findall(r"\d+", v_str))
|
|
647
647
|
except Exception:
|
|
@@ -672,22 +672,40 @@ def update_codefetch():
|
|
|
672
672
|
return
|
|
673
673
|
|
|
674
674
|
print(f"Update available: v{latest_version} (current: v{__version__})")
|
|
675
|
-
print(f"Updating {package_name}...")
|
|
676
675
|
else:
|
|
677
|
-
print(f"
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
676
|
+
print(f"Checking {package_name}...")
|
|
677
|
+
|
|
678
|
+
print(f"Updating {package_name}...")
|
|
679
|
+
|
|
680
|
+
if sys.platform == "win32":
|
|
681
|
+
# On Windows, pip cannot overwrite codefetch.exe while this process is executing it.
|
|
682
|
+
# Spawn PowerShell to wait 800ms for this process to exit, then run pip install cleanly.
|
|
683
|
+
target_v = f"v{latest_version}" if latest_version else "latest version"
|
|
684
|
+
ps_cmd = (
|
|
685
|
+
f"Start-Sleep -Milliseconds 800; "
|
|
686
|
+
f"& '{sys.executable}' -m pip install --upgrade {package_name}; "
|
|
687
|
+
f"if ($LASTEXITCODE -eq 0) {{ Write-Host '`nSuccessfully updated CodeFetch to {target_v}!' }} "
|
|
688
|
+
f"else {{ Write-Host '`nUpdate failed. You can manually update with: pip install --upgrade {package_name}' }}"
|
|
689
|
+
)
|
|
690
|
+
try:
|
|
691
|
+
subprocess.Popen(["powershell", "-NoProfile", "-Command", ps_cmd])
|
|
692
|
+
sys.exit(0)
|
|
693
|
+
except Exception as e:
|
|
694
|
+
print(f"\nError launching updater: {e}")
|
|
695
|
+
print(f"You can manually update with: pip install --upgrade {package_name}")
|
|
696
|
+
else:
|
|
697
|
+
cmd = [sys.executable, "-m", "pip", "install", "--upgrade", package_name]
|
|
698
|
+
try:
|
|
699
|
+
result = subprocess.run(cmd)
|
|
700
|
+
if result.returncode == 0:
|
|
701
|
+
target_v = f"v{latest_version}" if latest_version else "the latest version"
|
|
702
|
+
print(f"\nSuccessfully updated CodeFetch to {target_v}!")
|
|
703
|
+
else:
|
|
704
|
+
print(f"\nUpdate failed (exit code {result.returncode}).")
|
|
705
|
+
print(f"You can manually update with: pip install --upgrade {package_name}")
|
|
706
|
+
except Exception as e:
|
|
707
|
+
print(f"\nError running update: {e}")
|
|
687
708
|
print(f"You can manually update with: pip install --upgrade {package_name}")
|
|
688
|
-
except Exception as e:
|
|
689
|
-
print(f"\nError running update: {e}")
|
|
690
|
-
print(f"You can manually update with: pip install --upgrade {package_name}")
|
|
691
709
|
|
|
692
710
|
|
|
693
711
|
def uninstall_codefetch(yes=False):
|
|
@@ -712,17 +730,35 @@ def uninstall_codefetch(yes=False):
|
|
|
712
730
|
pass
|
|
713
731
|
|
|
714
732
|
print("Uninstalling codefetch-cli...")
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
733
|
+
|
|
734
|
+
if sys.platform == "win32":
|
|
735
|
+
# On Windows, pip cannot delete codefetch.exe while this process is executing it.
|
|
736
|
+
# Spawn PowerShell to wait 800ms for this process to exit, then run pip uninstall cleanly.
|
|
737
|
+
ps_cmd = (
|
|
738
|
+
f"Start-Sleep -Milliseconds 800; "
|
|
739
|
+
f"& '{sys.executable}' -m pip uninstall -y codefetch-cli; "
|
|
740
|
+
f"& '{sys.executable}' -m pip uninstall -y codefetch; "
|
|
741
|
+
f"if ($LASTEXITCODE -eq 0) {{ Write-Host '`nSuccessfully uninstalled CodeFetch.' }} "
|
|
742
|
+
f"else {{ Write-Host '`nUninstall failed. You can manually uninstall with: pip uninstall codefetch-cli' }}"
|
|
743
|
+
)
|
|
744
|
+
try:
|
|
745
|
+
subprocess.Popen(["powershell", "-NoProfile", "-Command", ps_cmd])
|
|
746
|
+
sys.exit(0)
|
|
747
|
+
except Exception as e:
|
|
748
|
+
print(f"\nError launching uninstaller: {e}")
|
|
749
|
+
print("You can manually uninstall with: pip uninstall codefetch-cli")
|
|
750
|
+
else:
|
|
751
|
+
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "codefetch-cli"]
|
|
752
|
+
try:
|
|
753
|
+
result = subprocess.run(cmd)
|
|
754
|
+
if result.returncode == 0:
|
|
755
|
+
print("\nSuccessfully uninstalled CodeFetch.")
|
|
756
|
+
else:
|
|
757
|
+
print(f"\nUninstall failed (exit code {result.returncode}).")
|
|
758
|
+
print("You can manually uninstall with: pip uninstall codefetch-cli")
|
|
759
|
+
except Exception as e:
|
|
760
|
+
print(f"\nError during uninstall: {e}")
|
|
722
761
|
print("You can manually uninstall with: pip uninstall codefetch-cli")
|
|
723
|
-
except Exception as e:
|
|
724
|
-
print(f"\nError during uninstall: {e}")
|
|
725
|
-
print("You can manually uninstall with: pip uninstall codefetch-cli")
|
|
726
762
|
|
|
727
763
|
|
|
728
764
|
class CodefetchParser(argparse.ArgumentParser):
|
|
@@ -7,7 +7,7 @@ long_description = readme_path.read_text(encoding="utf-8") if readme_path.exists
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="codefetch-cli",
|
|
10
|
-
version="1.2.
|
|
10
|
+
version="1.2.7",
|
|
11
11
|
description="Quickly fetch code files from GitHub repositories with simple commands",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|