codefetch-cli 1.2.5__py3-none-any.whl → 1.2.6__py3-none-any.whl
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/__init__.py +1 -1
- codefetch/cli.py +52 -3
- {codefetch_cli-1.2.5.dist-info → codefetch_cli-1.2.6.dist-info}/METADATA +8 -3
- codefetch_cli-1.2.6.dist-info/RECORD +8 -0
- codefetch_cli-1.2.5.dist-info/RECORD +0 -8
- {codefetch_cli-1.2.5.dist-info → codefetch_cli-1.2.6.dist-info}/WHEEL +0 -0
- {codefetch_cli-1.2.5.dist-info → codefetch_cli-1.2.6.dist-info}/entry_points.txt +0 -0
- {codefetch_cli-1.2.5.dist-info → codefetch_cli-1.2.6.dist-info}/licenses/LICENSE +0 -0
- {codefetch_cli-1.2.5.dist-info → codefetch_cli-1.2.6.dist-info}/top_level.txt +0 -0
codefetch/__init__.py
CHANGED
codefetch/cli.py
CHANGED
|
@@ -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.6"
|
|
22
22
|
|
|
23
23
|
# Supported code, data, and config extensions
|
|
24
24
|
CODE_EXTENSIONS = {
|
|
@@ -63,6 +63,7 @@ USAGE:
|
|
|
63
63
|
codefetch -l <owner>/<repo> List all code files in a repository
|
|
64
64
|
codefetch -R <username> List public repositories for a user
|
|
65
65
|
codefetch --update Update CodeFetch to the latest version
|
|
66
|
+
codefetch --uninstall Uninstall CodeFetch from your system
|
|
66
67
|
|
|
67
68
|
POPULAR EXAMPLES:
|
|
68
69
|
# Download from any repository:
|
|
@@ -80,6 +81,10 @@ POPULAR EXAMPLES:
|
|
|
80
81
|
codefetch -l torvalds/linux # list files in a repo
|
|
81
82
|
codefetch -R torvalds # list repos belonging to user
|
|
82
83
|
|
|
84
|
+
# Package management:
|
|
85
|
+
codefetch --update # update to latest PyPI release
|
|
86
|
+
codefetch --uninstall # uninstall CodeFetch package
|
|
87
|
+
|
|
83
88
|
SETTING A DEFAULT REPOSITORY (OPTIONAL):
|
|
84
89
|
If you frequently work with the same repo, you can set it as default:
|
|
85
90
|
codefetch --set-default owner/repo # sets default repo
|
|
@@ -100,6 +105,8 @@ FLAGS & OPTIONS:
|
|
|
100
105
|
--config Show current saved configuration
|
|
101
106
|
--reset-config Reset configuration back to defaults
|
|
102
107
|
-U, --update Update CodeFetch to the latest version from PyPI
|
|
108
|
+
--uninstall Uninstall CodeFetch from your system
|
|
109
|
+
-y, --yes Confirm uninstall without prompting
|
|
103
110
|
-v, --version Show version number
|
|
104
111
|
-h, --help Show this help message
|
|
105
112
|
"""
|
|
@@ -634,7 +641,7 @@ def fetch_file(filename, owner=None, repo=None, branch=None,
|
|
|
634
641
|
|
|
635
642
|
|
|
636
643
|
def parse_version_tuple(v_str):
|
|
637
|
-
"""Parse version string like '1.2.
|
|
644
|
+
"""Parse version string like '1.2.6' into a comparable tuple of integers."""
|
|
638
645
|
try:
|
|
639
646
|
return tuple(int(x) for x in re.findall(r"\d+", v_str))
|
|
640
647
|
except Exception:
|
|
@@ -683,6 +690,41 @@ def update_codefetch():
|
|
|
683
690
|
print(f"You can manually update with: pip install --upgrade {package_name}")
|
|
684
691
|
|
|
685
692
|
|
|
693
|
+
def uninstall_codefetch(yes=False):
|
|
694
|
+
"""Uninstall codefetch-cli package from system."""
|
|
695
|
+
if not yes:
|
|
696
|
+
try:
|
|
697
|
+
choice = input("Are you sure you want to uninstall CodeFetch? [y/N]: ").strip().lower()
|
|
698
|
+
except (EOFError, KeyboardInterrupt):
|
|
699
|
+
print("\nCancelled.")
|
|
700
|
+
return
|
|
701
|
+
|
|
702
|
+
if choice not in ("y", "yes"):
|
|
703
|
+
print("Uninstall cancelled.")
|
|
704
|
+
return
|
|
705
|
+
|
|
706
|
+
# Clean up ~/.codefetch.json configuration file if present
|
|
707
|
+
if CONFIG_FILE.exists():
|
|
708
|
+
try:
|
|
709
|
+
CONFIG_FILE.unlink()
|
|
710
|
+
print(f"Removed configuration file: {CONFIG_FILE}")
|
|
711
|
+
except Exception:
|
|
712
|
+
pass
|
|
713
|
+
|
|
714
|
+
print("Uninstalling codefetch-cli...")
|
|
715
|
+
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "codefetch-cli"]
|
|
716
|
+
try:
|
|
717
|
+
result = subprocess.run(cmd)
|
|
718
|
+
if result.returncode == 0:
|
|
719
|
+
print("\nSuccessfully uninstalled CodeFetch.")
|
|
720
|
+
else:
|
|
721
|
+
print(f"\nUninstall failed (exit code {result.returncode}).")
|
|
722
|
+
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
|
+
|
|
727
|
+
|
|
686
728
|
class CodefetchParser(argparse.ArgumentParser):
|
|
687
729
|
"""Custom parser providing clean, intuitive help formatting."""
|
|
688
730
|
|
|
@@ -713,7 +755,9 @@ def build_parser():
|
|
|
713
755
|
parser.add_argument("--set-default-user", type=str, help="Save default GitHub user")
|
|
714
756
|
parser.add_argument("--config", action="store_true", help="Display active configuration")
|
|
715
757
|
parser.add_argument("--reset-config", action="store_true", help="Reset configuration back to defaults")
|
|
716
|
-
parser.add_argument("-U", "--update", action="store_true", help="Update CodeFetch to the latest version")
|
|
758
|
+
parser.add_argument("-U", "--update", action="store_true", help="Update CodeFetch to the latest version from PyPI")
|
|
759
|
+
parser.add_argument("--uninstall", action="store_true", help="Uninstall CodeFetch from your system")
|
|
760
|
+
parser.add_argument("-y", "--yes", action="store_true", help="Confirm uninstall without prompting")
|
|
717
761
|
parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {__version__}")
|
|
718
762
|
parser.add_argument("-h", "--help", action="help", help="Show help message")
|
|
719
763
|
|
|
@@ -788,6 +832,11 @@ def main():
|
|
|
788
832
|
update_codefetch()
|
|
789
833
|
return
|
|
790
834
|
|
|
835
|
+
# Handle --uninstall
|
|
836
|
+
if args.uninstall:
|
|
837
|
+
uninstall_codefetch(yes=args.yes)
|
|
838
|
+
return
|
|
839
|
+
|
|
791
840
|
config = load_config()
|
|
792
841
|
default_owner = config.get("owner", DEFAULT_OWNER)
|
|
793
842
|
default_repo = config.get("repo", DEFAULT_REPO)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codefetch-cli
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.6
|
|
4
4
|
Summary: Quickly fetch code files from GitHub repositories with simple commands
|
|
5
5
|
Home-page: https://github.com/InzamamulQureshi/Codefetch
|
|
6
6
|
Author: Inzamamul Qureshi
|
|
@@ -36,6 +36,7 @@ CodeFetch is a lightweight command-line utility and Python library designed to q
|
|
|
36
36
|
- **Repository Discovery**: List all public repositories for any GitHub user with `--repos`.
|
|
37
37
|
- **Tree Exploration**: List all supported code files within a repository with `--list`.
|
|
38
38
|
- **Self-Updating**: Keep CodeFetch updated to the latest PyPI release with `codefetch --update`.
|
|
39
|
+
- **Clean Uninstall**: Easily remove CodeFetch and its configuration with `codefetch --uninstall`.
|
|
39
40
|
- **Python Library Support**: Import and use programmatically with `import codefetch as cf`.
|
|
40
41
|
- **Optional Persistent Defaults**: Save a default repository or user with `--set-default` if you frequently work with the same repository.
|
|
41
42
|
- **Zero Runtime Dependencies**: Built using only the Python standard library with zero third-party dependencies.
|
|
@@ -130,11 +131,14 @@ codefetch --config
|
|
|
130
131
|
codefetch --reset-config
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
### 5.
|
|
134
|
+
### 5. Package Management
|
|
134
135
|
|
|
135
136
|
```bash
|
|
136
137
|
# Update CodeFetch to the latest version published on PyPI
|
|
137
138
|
codefetch --update
|
|
139
|
+
|
|
140
|
+
# Uninstall CodeFetch and remove local configuration
|
|
141
|
+
codefetch --uninstall
|
|
138
142
|
```
|
|
139
143
|
|
|
140
144
|
---
|
|
@@ -176,7 +180,8 @@ print(f"Found {len(files)} files")
|
|
|
176
180
|
| `--set-default-user` | Set persistent default user | `codefetch --set-default-user username` |
|
|
177
181
|
| `--config` | Display active configuration | `codefetch --config` |
|
|
178
182
|
| `--reset-config` | Reset configuration back to defaults | `codefetch --reset-config` |
|
|
179
|
-
| `-U`, `--update` | Update CodeFetch to latest PyPI
|
|
183
|
+
| `-U`, `--update` | Update CodeFetch to latest PyPI release | `codefetch --update` |
|
|
184
|
+
| `--uninstall` | Uninstall CodeFetch from your system | `codefetch --uninstall` |
|
|
180
185
|
| `-v`, `--version` | Display version information | `codefetch --version` |
|
|
181
186
|
| `-h`, `--help` | Display help and usage message | `codefetch --help` |
|
|
182
187
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
codefetch/__init__.py,sha256=jtbbu9FIih6Rys0rw-qtWaaMhwpalny5LAKNralmYmk,5049
|
|
2
|
+
codefetch/cli.py,sha256=BCqYq8idjn8qIgMnXC2BS9_G1vKhLeeML4DMZNRuVWM,35887
|
|
3
|
+
codefetch_cli-1.2.6.dist-info/licenses/LICENSE,sha256=hqEPPm8jxPava5BfKIj3wTIXNyWNwsIvPv2daPCOijY,1094
|
|
4
|
+
codefetch_cli-1.2.6.dist-info/METADATA,sha256=nbqiiyqFOItehpLK9YYbSv8uOoQnh_uJlnwqvgDZdH8,7262
|
|
5
|
+
codefetch_cli-1.2.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
6
|
+
codefetch_cli-1.2.6.dist-info/entry_points.txt,sha256=jFLRsBB_USeSdqjewcXZfnOzY56s0PZat7mnYkYdrXg,49
|
|
7
|
+
codefetch_cli-1.2.6.dist-info/top_level.txt,sha256=kHrftHbyqugb8LQXjW1dR9uI-JFjZQJ0sUReIa45yXQ,10
|
|
8
|
+
codefetch_cli-1.2.6.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
codefetch/__init__.py,sha256=TnExw5rEX9F0Y72dvp-rNut71JfVHBT6jco4-x8nfmE,5049
|
|
2
|
-
codefetch/cli.py,sha256=UC-ZpV3kYJ2zuAmOCD64YgT3unnhPAMDhYQ4a5TNTUo,33929
|
|
3
|
-
codefetch_cli-1.2.5.dist-info/licenses/LICENSE,sha256=hqEPPm8jxPava5BfKIj3wTIXNyWNwsIvPv2daPCOijY,1094
|
|
4
|
-
codefetch_cli-1.2.5.dist-info/METADATA,sha256=gjQ8dwKPqb3v-AyGvurQV0oD6XX00SLulqvkFcbiYNU,6994
|
|
5
|
-
codefetch_cli-1.2.5.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
6
|
-
codefetch_cli-1.2.5.dist-info/entry_points.txt,sha256=jFLRsBB_USeSdqjewcXZfnOzY56s0PZat7mnYkYdrXg,49
|
|
7
|
-
codefetch_cli-1.2.5.dist-info/top_level.txt,sha256=kHrftHbyqugb8LQXjW1dR9uI-JFjZQJ0sUReIa45yXQ,10
|
|
8
|
-
codefetch_cli-1.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|