codefetch-cli 1.2.0__tar.gz → 1.2.1__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.0/codefetch_cli.egg-info → codefetch_cli-1.2.1}/PKG-INFO +9 -4
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/README.md +8 -3
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch/__init__.py +1 -1
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch/cli.py +99 -40
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1/codefetch_cli.egg-info}/PKG-INFO +9 -4
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/pyproject.toml +1 -1
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/setup.py +1 -1
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/LICENSE +0 -0
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch_cli.egg-info/SOURCES.txt +0 -0
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch_cli.egg-info/dependency_links.txt +0 -0
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch_cli.egg-info/entry_points.txt +0 -0
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/codefetch_cli.egg-info/top_level.txt +0 -0
- {codefetch_cli-1.2.0 → codefetch_cli-1.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codefetch-cli
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
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
|
|
@@ -171,9 +171,14 @@ codefetch --reset-config
|
|
|
171
171
|
|
|
172
172
|
## Supported File Extensions
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
- **Data & Tables**: `.csv`, `.tsv`, `.json`, `.jsonl`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.cfg`, `.conf`, `.env`
|
|
175
|
+
- **Data Science**: `.ipynb`, `.py`, `.r`, `.rmd`, `.m`
|
|
176
|
+
- **Languages**: `.c`, `.cpp`, `.h`, `.hpp`, `.rs`, `.go`, `.java`, `.kt`, `.cs`, `.swift`, `.dart`, `.php`
|
|
177
|
+
- **Web**: `.html`, `.css`, `.scss`, `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`
|
|
178
|
+
- **Scripts & Systems**: `.sh`, `.bash`, `.zsh`, `.fish`, `.bat`, `.cmd`, `.ps1`, `.lua`, `.rb`, `.asm`, `.s`, `.hex`
|
|
179
|
+
- **Database & Schemas**: `.sql`, `.graphql`, `.gql`, `.proto`
|
|
180
|
+
- **Documentation**: `.md`, `.markdown`, `.rst`, `.txt`, `.tex`, `.log`
|
|
181
|
+
- **Build Files**: `Dockerfile`, `Makefile`, `CMakeLists.txt`, `Gemfile`, `Procfile`
|
|
177
182
|
|
|
178
183
|
---
|
|
179
184
|
|
|
@@ -149,9 +149,14 @@ codefetch --reset-config
|
|
|
149
149
|
|
|
150
150
|
## Supported File Extensions
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
- **Data & Tables**: `.csv`, `.tsv`, `.json`, `.jsonl`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.cfg`, `.conf`, `.env`
|
|
153
|
+
- **Data Science**: `.ipynb`, `.py`, `.r`, `.rmd`, `.m`
|
|
154
|
+
- **Languages**: `.c`, `.cpp`, `.h`, `.hpp`, `.rs`, `.go`, `.java`, `.kt`, `.cs`, `.swift`, `.dart`, `.php`
|
|
155
|
+
- **Web**: `.html`, `.css`, `.scss`, `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`
|
|
156
|
+
- **Scripts & Systems**: `.sh`, `.bash`, `.zsh`, `.fish`, `.bat`, `.cmd`, `.ps1`, `.lua`, `.rb`, `.asm`, `.s`, `.hex`
|
|
157
|
+
- **Database & Schemas**: `.sql`, `.graphql`, `.gql`, `.proto`
|
|
158
|
+
- **Documentation**: `.md`, `.markdown`, `.rst`, `.txt`, `.tex`, `.log`
|
|
159
|
+
- **Build Files**: `Dockerfile`, `Makefile`, `CMakeLists.txt`, `Gemfile`, `Procfile`
|
|
155
160
|
|
|
156
161
|
---
|
|
157
162
|
|
|
@@ -18,13 +18,84 @@ DEFAULT_BRANCH = "main"
|
|
|
18
18
|
|
|
19
19
|
CONFIG_FILE = Path.home() / ".codefetch.json"
|
|
20
20
|
|
|
21
|
-
# Supported code extensions
|
|
21
|
+
# Supported code, data, and config extensions
|
|
22
22
|
CODE_EXTENSIONS = {
|
|
23
|
-
|
|
24
|
-
".
|
|
25
|
-
".
|
|
23
|
+
# Data & Tables
|
|
24
|
+
".csv", ".tsv", ".json", ".jsonl", ".yaml", ".yml", ".toml",
|
|
25
|
+
".xml", ".ini", ".cfg", ".conf", ".env", ".properties",
|
|
26
|
+
# Python & Data Science
|
|
27
|
+
".py", ".pyw", ".ipynb", ".r", ".rmd", ".m",
|
|
28
|
+
# C / C++ / Systems
|
|
29
|
+
".c", ".cpp", ".cc", ".cxx", ".h", ".hpp", ".hxx", ".rs", ".go",
|
|
30
|
+
# JVM & .NET
|
|
31
|
+
".java", ".kt", ".kts", ".scala", ".cs", ".fs", ".vb",
|
|
32
|
+
# Web & Frontend
|
|
33
|
+
".html", ".htm", ".css", ".scss", ".sass", ".less",
|
|
34
|
+
".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx", ".vue", ".svelte", ".php",
|
|
35
|
+
# Mobile & Apple
|
|
36
|
+
".swift", ".dart",
|
|
37
|
+
# Scripts & Shells
|
|
38
|
+
".sh", ".bash", ".zsh", ".fish", ".bat", ".cmd", ".ps1", ".psm1",
|
|
39
|
+
".lua", ".rb", ".pl", ".pm",
|
|
40
|
+
# Assembly & Hardware
|
|
41
|
+
".asm", ".s", ".hex", ".v", ".sv", ".vhdl", ".vhd",
|
|
42
|
+
# Database & Schema
|
|
43
|
+
".sql", ".graphql", ".gql", ".proto",
|
|
44
|
+
# Documents & Text
|
|
45
|
+
".txt", ".text", ".md", ".markdown", ".rst", ".tex", ".log"
|
|
26
46
|
}
|
|
27
47
|
|
|
48
|
+
# Recognized extensionless or special build files
|
|
49
|
+
NAMED_FILES = {
|
|
50
|
+
"dockerfile", "makefile", "gemfile", "procfile", "vagrantfile",
|
|
51
|
+
"cmakelists.txt", "jenkinsfile", "license"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
HELP_MESSAGE = """\
|
|
55
|
+
CodeFetch - Download single code files from GitHub without cloning entire repos.
|
|
56
|
+
|
|
57
|
+
USAGE:
|
|
58
|
+
codefetch <filename> Download a file from default repo (MPL)
|
|
59
|
+
codefetch <repo> <filename> Download from another repo (e.g. DS EXP1.c)
|
|
60
|
+
codefetch <user>/<repo> <filename> Download from any GitHub user/repo
|
|
61
|
+
|
|
62
|
+
QUICK EXAMPLES:
|
|
63
|
+
Download a file:
|
|
64
|
+
codefetch 8.1.py Save 8.1.py to current directory
|
|
65
|
+
codefetch data.csv Save data.csv to current directory
|
|
66
|
+
codefetch DS EXP1.c Save EXP1.c from repo 'DS'
|
|
67
|
+
codefetch DS EXP1.c -o my_code.c Save with a custom output filename
|
|
68
|
+
codefetch InzamamulQureshi/Codefetch setup.py
|
|
69
|
+
|
|
70
|
+
View code in terminal (without downloading):
|
|
71
|
+
codefetch -s 8.1.py Display 8.1.py in terminal
|
|
72
|
+
codefetch -s DS EXP1.c Display EXP1.c in terminal
|
|
73
|
+
|
|
74
|
+
Browse files and repositories:
|
|
75
|
+
codefetch -l List all code files in default repo (MPL)
|
|
76
|
+
codefetch -l DS List all code files in repo 'DS'
|
|
77
|
+
codefetch -l user/repo List code files in any user repository
|
|
78
|
+
codefetch -R List all repositories of default user (Reaver101)
|
|
79
|
+
codefetch -R -u <username> List all repositories of any GitHub user
|
|
80
|
+
|
|
81
|
+
SETTINGS & DEFAULTS:
|
|
82
|
+
codefetch --set-default <repo> Set permanent default repo (e.g. DS)
|
|
83
|
+
codefetch --set-default-user <user> Set permanent default GitHub user
|
|
84
|
+
codefetch --config View current active settings
|
|
85
|
+
codefetch --reset-config Reset all settings back to default
|
|
86
|
+
|
|
87
|
+
OPTIONS:
|
|
88
|
+
-s, --show View file contents in terminal instead of saving
|
|
89
|
+
-o, --output <file> Custom filename or path to save the downloaded file
|
|
90
|
+
-l, --list List available code files in the repository
|
|
91
|
+
-R, --repos List all public repositories for the user
|
|
92
|
+
-r, --repo <name> Specify repository name or URL
|
|
93
|
+
-u, --user <name> Specify GitHub username (default: Reaver101)
|
|
94
|
+
-b, --branch <name> Specify branch name (default: main)
|
|
95
|
+
-v, --version Show version number
|
|
96
|
+
-h, --help Show this help guide
|
|
97
|
+
"""
|
|
98
|
+
|
|
28
99
|
|
|
29
100
|
def load_config():
|
|
30
101
|
"""Load configuration from environment variables and local config file."""
|
|
@@ -171,11 +242,12 @@ def list_files(owner, repo, branch="main"):
|
|
|
171
242
|
continue
|
|
172
243
|
|
|
173
244
|
path = item.get("path", "")
|
|
245
|
+
base_name = path.rsplit("/", 1)[-1].lower()
|
|
174
246
|
suffix = ""
|
|
175
|
-
if "." in
|
|
176
|
-
suffix = "." +
|
|
247
|
+
if "." in base_name:
|
|
248
|
+
suffix = "." + base_name.rsplit(".", 1)[-1]
|
|
177
249
|
|
|
178
|
-
if suffix in CODE_EXTENSIONS:
|
|
250
|
+
if suffix in CODE_EXTENSIONS or base_name in NAMED_FILES:
|
|
179
251
|
files.append(path)
|
|
180
252
|
|
|
181
253
|
files.sort(key=str.lower)
|
|
@@ -335,38 +407,22 @@ def fetch_file(filename, owner=DEFAULT_OWNER, repo=DEFAULT_REPO, branch=DEFAULT_
|
|
|
335
407
|
print(f"Error saving file '{out_name}': {e}")
|
|
336
408
|
|
|
337
409
|
|
|
410
|
+
class CodefetchParser(argparse.ArgumentParser):
|
|
411
|
+
"""Custom parser providing clean, intuitive help formatting."""
|
|
412
|
+
|
|
413
|
+
def format_help(self):
|
|
414
|
+
return HELP_MESSAGE
|
|
415
|
+
|
|
416
|
+
def error(self, message):
|
|
417
|
+
sys.stderr.write(f"Error: {message}\n\nRun 'codefetch --help' for usage instructions.\n")
|
|
418
|
+
sys.exit(2)
|
|
419
|
+
|
|
420
|
+
|
|
338
421
|
def build_parser():
|
|
339
422
|
"""Build argument parser with full CLI options."""
|
|
340
|
-
parser =
|
|
423
|
+
parser = CodefetchParser(
|
|
341
424
|
prog="codefetch",
|
|
342
|
-
|
|
343
|
-
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
344
|
-
epilog="""
|
|
345
|
-
Usage Examples:
|
|
346
|
-
|
|
347
|
-
Fetch from default repository:
|
|
348
|
-
codefetch 8.1.py
|
|
349
|
-
codefetch --show 8.1.py
|
|
350
|
-
codefetch --list
|
|
351
|
-
|
|
352
|
-
Fetch from other repositories:
|
|
353
|
-
codefetch -r DS EXP1.c
|
|
354
|
-
codefetch DS EXP1.c
|
|
355
|
-
codefetch DS/EXP1.c
|
|
356
|
-
codefetch -r DS --list
|
|
357
|
-
|
|
358
|
-
Fetch from any GitHub user and repository:
|
|
359
|
-
codefetch InzamamulQureshi/Codefetch setup.py
|
|
360
|
-
codefetch -u InzamamulQureshi -r Codefetch setup.py
|
|
361
|
-
codefetch --list InzamamulQureshi/Codefetch
|
|
362
|
-
codefetch --repos -u InzamamulQureshi
|
|
363
|
-
|
|
364
|
-
Configuration:
|
|
365
|
-
codefetch --set-default DS
|
|
366
|
-
codefetch --set-default-user InzamamulQureshi
|
|
367
|
-
codefetch --config
|
|
368
|
-
codefetch --reset-config
|
|
369
|
-
"""
|
|
425
|
+
add_help=True,
|
|
370
426
|
)
|
|
371
427
|
parser.add_argument(
|
|
372
428
|
"args",
|
|
@@ -431,7 +487,7 @@ Usage Examples:
|
|
|
431
487
|
parser.add_argument(
|
|
432
488
|
"-v", "--version",
|
|
433
489
|
action="version",
|
|
434
|
-
version="codefetch 1.2.
|
|
490
|
+
version="codefetch 1.2.1",
|
|
435
491
|
)
|
|
436
492
|
return parser
|
|
437
493
|
|
|
@@ -560,7 +616,7 @@ def main():
|
|
|
560
616
|
list_files(owner=target_owner, repo=target_repo, branch=branch)
|
|
561
617
|
return
|
|
562
618
|
|
|
563
|
-
#
|
|
619
|
+
# If no action and no files provided, print the clean help guide
|
|
564
620
|
if not args.args and not args.repo:
|
|
565
621
|
parser.print_help()
|
|
566
622
|
return
|
|
@@ -579,8 +635,11 @@ def main():
|
|
|
579
635
|
)
|
|
580
636
|
|
|
581
637
|
if not resolved_filename:
|
|
582
|
-
print("Error: No filename specified
|
|
583
|
-
|
|
638
|
+
print("Error: No filename specified.\n")
|
|
639
|
+
print("Usage:")
|
|
640
|
+
print(" codefetch <filename> Download a file")
|
|
641
|
+
print(" codefetch <repo> <filename> Download from a repository")
|
|
642
|
+
print(" codefetch --help View full guide and examples")
|
|
584
643
|
return
|
|
585
644
|
|
|
586
645
|
fetch_file(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codefetch-cli
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
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
|
|
@@ -171,9 +171,14 @@ codefetch --reset-config
|
|
|
171
171
|
|
|
172
172
|
## Supported File Extensions
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
- **Data & Tables**: `.csv`, `.tsv`, `.json`, `.jsonl`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.cfg`, `.conf`, `.env`
|
|
175
|
+
- **Data Science**: `.ipynb`, `.py`, `.r`, `.rmd`, `.m`
|
|
176
|
+
- **Languages**: `.c`, `.cpp`, `.h`, `.hpp`, `.rs`, `.go`, `.java`, `.kt`, `.cs`, `.swift`, `.dart`, `.php`
|
|
177
|
+
- **Web**: `.html`, `.css`, `.scss`, `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`
|
|
178
|
+
- **Scripts & Systems**: `.sh`, `.bash`, `.zsh`, `.fish`, `.bat`, `.cmd`, `.ps1`, `.lua`, `.rb`, `.asm`, `.s`, `.hex`
|
|
179
|
+
- **Database & Schemas**: `.sql`, `.graphql`, `.gql`, `.proto`
|
|
180
|
+
- **Documentation**: `.md`, `.markdown`, `.rst`, `.txt`, `.tex`, `.log`
|
|
181
|
+
- **Build Files**: `Dockerfile`, `Makefile`, `CMakeLists.txt`, `Gemfile`, `Procfile`
|
|
177
182
|
|
|
178
183
|
---
|
|
179
184
|
|
|
@@ -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.1",
|
|
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
|