codefetch-cli 1.2.0__tar.gz → 1.2.2__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,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Reaver101
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 InzamamulQureshi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: codefetch-cli
3
+ Version: 1.2.2
4
+ Summary: Quickly fetch code files from GitHub repositories with simple commands
5
+ Home-page: https://github.com/InzamamulQureshi/Codefetch
6
+ Author: Inzamamul Qureshi
7
+ Author-email: Inzamamul Qureshi <inzamamulqureshi@gmail.com>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://github.com/InzamamulQureshi/Codefetch
10
+ Project-URL: Repository, https://github.com/InzamamulQureshi/Codefetch
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Environment :: Console
14
+ Classifier: Topic :: Utilities
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: author
19
+ Dynamic: home-page
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+
23
+ # CodeFetch
24
+
25
+ Quickly fetch code files from GitHub repositories with simple commands.
26
+
27
+ CodeFetch is a lightweight command-line utility designed to quickly inspect, preview, and download individual source code files directly from any GitHub repository without needing to clone full repositories.
28
+
29
+ ---
30
+
31
+ ## Features
32
+
33
+ - **Any User & Repository**: Fetch files from any public GitHub repository using intuitive syntax (`codefetch <owner>/<repo> <filename>`).
34
+ - **Terminal Preview**: Inspect code directly in your console with `--show` without saving it to disk.
35
+ - **Automatic Path & Case Resolution**: Automatically resolves case mismatches and finds files nested inside subdirectories.
36
+ - **Repository Discovery**: List all public repositories for any GitHub user with `--repos`.
37
+ - **Tree Exploration**: List all supported code files within a repository with `--list`.
38
+ - **Optional Persistent Defaults**: Save a default repository or user with `--set-default` if you frequently work with the same repository.
39
+ - **Zero Runtime Dependencies**: Built using only the Python standard library with zero third-party dependencies.
40
+
41
+ ---
42
+
43
+ ## Installation
44
+
45
+ ### From PyPI
46
+
47
+ ```bash
48
+ pip install codefetch-cli
49
+ ```
50
+
51
+ ### From GitHub
52
+
53
+ ```bash
54
+ pip install git+https://github.com/InzamamulQureshi/Codefetch.git
55
+ ```
56
+
57
+ ### From Local Source
58
+
59
+ Clone the repository and install locally:
60
+
61
+ ```bash
62
+ git clone https://github.com/InzamamulQureshi/Codefetch.git
63
+ cd Codefetch
64
+ pip install .
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Quick Start & Usage
70
+
71
+ ### 1. Download Files
72
+
73
+ Fetch a single file from any GitHub repository:
74
+
75
+ ```bash
76
+ # Fetch a file from any user and repository
77
+ codefetch owner/repo main.py
78
+
79
+ # Download a configuration or dataset
80
+ codefetch owner/repo data.csv
81
+ codefetch owner/repo config.yaml
82
+
83
+ # Download using explicit flags
84
+ codefetch -u owner -r repo main.py
85
+
86
+ # Save with a custom filename or destination path
87
+ codefetch owner/repo main.py -o custom_name.py
88
+ ```
89
+
90
+ ### 2. Preview in Terminal (Without Downloading)
91
+
92
+ Display the contents of a file directly in stdout with `-s` / `--show`:
93
+
94
+ ```bash
95
+ # Preview file content in terminal
96
+ codefetch -s owner/repo main.py
97
+ codefetch -s torvalds/linux Makefile
98
+ ```
99
+
100
+ ### 3. Explore Repositories and Files
101
+
102
+ ```bash
103
+ # List all code files in a repository
104
+ codefetch -l owner/repo
105
+ codefetch --list owner/repo
106
+
107
+ # List all public repositories for any GitHub user
108
+ codefetch -R -u username
109
+ codefetch --repos username
110
+ ```
111
+
112
+ ### 4. Configuration and Defaults (Optional)
113
+
114
+ By default, CodeFetch has no preset repository or user. If you frequently fetch files from the same repository, you can optionally configure defaults:
115
+
116
+ ```bash
117
+ # Set a default repository (saves both user and repo)
118
+ codefetch --set-default owner/repo
119
+
120
+ # Now you can fetch files directly without typing the repo name!
121
+ codefetch main.py
122
+ codefetch -l
123
+
124
+ # View current saved configuration
125
+ codefetch --config
126
+
127
+ # Reset all configuration back to defaults (no default repository)
128
+ codefetch --reset-config
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Command Reference
134
+
135
+ | Flag | Description | Example |
136
+ |---|---|---|
137
+ | `-s`, `--show` | Print file contents to terminal | `codefetch -s owner/repo main.py` |
138
+ | `-o`, `--output` | Specify destination output filename | `codefetch owner/repo main.py -o script.py` |
139
+ | `-l`, `--list` | List available code files in a repository | `codefetch -l owner/repo` |
140
+ | `-R`, `--repos` | List public repositories for a user | `codefetch -R -u username` |
141
+ | `-r`, `--repo` | Specify repository name or URL | `codefetch -r repo main.py` |
142
+ | `-u`, `--user` | Specify GitHub username or organization | `codefetch -u username -r repo main.py` |
143
+ | `-b`, `--branch` | Branch name (default: `main`) | `codefetch -b master owner/repo Makefile` |
144
+ | `--set-default` | Set persistent default repository | `codefetch --set-default owner/repo` |
145
+ | `--set-default-user` | Set persistent default user | `codefetch --set-default-user username` |
146
+ | `--config` | Display active configuration | `codefetch --config` |
147
+ | `--reset-config` | Reset configuration back to defaults | `codefetch --reset-config` |
148
+ | `-v`, `--version` | Display version information | `codefetch --version` |
149
+ | `-h`, `--help` | Display help and usage message | `codefetch --help` |
150
+
151
+ ---
152
+
153
+ ## Supported File Extensions
154
+
155
+ CodeFetch recognizes and lists common source and document files:
156
+
157
+ - **Data & Tables**: `.csv`, `.tsv`, `.json`, `.jsonl`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.cfg`, `.conf`, `.env`
158
+ - **Data Science**: `.ipynb`, `.py`, `.r`, `.rmd`, `.m`
159
+ - **Languages**: `.c`, `.cpp`, `.h`, `.hpp`, `.rs`, `.go`, `.java`, `.kt`, `.cs`, `.swift`, `.dart`, `.php`
160
+ - **Web**: `.html`, `.css`, `.scss`, `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`
161
+ - **Scripts & Systems**: `.sh`, `.bash`, `.zsh`, `.fish`, `.bat`, `.cmd`, `.ps1`, `.lua`, `.rb`, `.asm`, `.s`, `.hex`
162
+ - **Database & Schemas**: `.sql`, `.graphql`, `.gql`, `.proto`
163
+ - **Documentation**: `.md`, `.markdown`, `.rst`, `.txt`, `.tex`, `.log`
164
+ - **Build Files**: `Dockerfile`, `Makefile`, `CMakeLists.txt`, `Gemfile`, `Procfile`
165
+
166
+ ---
167
+
168
+ ## License
169
+
170
+ This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,148 @@
1
+ # CodeFetch
2
+
3
+ Quickly fetch code files from GitHub repositories with simple commands.
4
+
5
+ CodeFetch is a lightweight command-line utility designed to quickly inspect, preview, and download individual source code files directly from any GitHub repository without needing to clone full repositories.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - **Any User & Repository**: Fetch files from any public GitHub repository using intuitive syntax (`codefetch <owner>/<repo> <filename>`).
12
+ - **Terminal Preview**: Inspect code directly in your console with `--show` without saving it to disk.
13
+ - **Automatic Path & Case Resolution**: Automatically resolves case mismatches and finds files nested inside subdirectories.
14
+ - **Repository Discovery**: List all public repositories for any GitHub user with `--repos`.
15
+ - **Tree Exploration**: List all supported code files within a repository with `--list`.
16
+ - **Optional Persistent Defaults**: Save a default repository or user with `--set-default` if you frequently work with the same repository.
17
+ - **Zero Runtime Dependencies**: Built using only the Python standard library with zero third-party dependencies.
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### From PyPI
24
+
25
+ ```bash
26
+ pip install codefetch-cli
27
+ ```
28
+
29
+ ### From GitHub
30
+
31
+ ```bash
32
+ pip install git+https://github.com/InzamamulQureshi/Codefetch.git
33
+ ```
34
+
35
+ ### From Local Source
36
+
37
+ Clone the repository and install locally:
38
+
39
+ ```bash
40
+ git clone https://github.com/InzamamulQureshi/Codefetch.git
41
+ cd Codefetch
42
+ pip install .
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Quick Start & Usage
48
+
49
+ ### 1. Download Files
50
+
51
+ Fetch a single file from any GitHub repository:
52
+
53
+ ```bash
54
+ # Fetch a file from any user and repository
55
+ codefetch owner/repo main.py
56
+
57
+ # Download a configuration or dataset
58
+ codefetch owner/repo data.csv
59
+ codefetch owner/repo config.yaml
60
+
61
+ # Download using explicit flags
62
+ codefetch -u owner -r repo main.py
63
+
64
+ # Save with a custom filename or destination path
65
+ codefetch owner/repo main.py -o custom_name.py
66
+ ```
67
+
68
+ ### 2. Preview in Terminal (Without Downloading)
69
+
70
+ Display the contents of a file directly in stdout with `-s` / `--show`:
71
+
72
+ ```bash
73
+ # Preview file content in terminal
74
+ codefetch -s owner/repo main.py
75
+ codefetch -s torvalds/linux Makefile
76
+ ```
77
+
78
+ ### 3. Explore Repositories and Files
79
+
80
+ ```bash
81
+ # List all code files in a repository
82
+ codefetch -l owner/repo
83
+ codefetch --list owner/repo
84
+
85
+ # List all public repositories for any GitHub user
86
+ codefetch -R -u username
87
+ codefetch --repos username
88
+ ```
89
+
90
+ ### 4. Configuration and Defaults (Optional)
91
+
92
+ By default, CodeFetch has no preset repository or user. If you frequently fetch files from the same repository, you can optionally configure defaults:
93
+
94
+ ```bash
95
+ # Set a default repository (saves both user and repo)
96
+ codefetch --set-default owner/repo
97
+
98
+ # Now you can fetch files directly without typing the repo name!
99
+ codefetch main.py
100
+ codefetch -l
101
+
102
+ # View current saved configuration
103
+ codefetch --config
104
+
105
+ # Reset all configuration back to defaults (no default repository)
106
+ codefetch --reset-config
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Command Reference
112
+
113
+ | Flag | Description | Example |
114
+ |---|---|---|
115
+ | `-s`, `--show` | Print file contents to terminal | `codefetch -s owner/repo main.py` |
116
+ | `-o`, `--output` | Specify destination output filename | `codefetch owner/repo main.py -o script.py` |
117
+ | `-l`, `--list` | List available code files in a repository | `codefetch -l owner/repo` |
118
+ | `-R`, `--repos` | List public repositories for a user | `codefetch -R -u username` |
119
+ | `-r`, `--repo` | Specify repository name or URL | `codefetch -r repo main.py` |
120
+ | `-u`, `--user` | Specify GitHub username or organization | `codefetch -u username -r repo main.py` |
121
+ | `-b`, `--branch` | Branch name (default: `main`) | `codefetch -b master owner/repo Makefile` |
122
+ | `--set-default` | Set persistent default repository | `codefetch --set-default owner/repo` |
123
+ | `--set-default-user` | Set persistent default user | `codefetch --set-default-user username` |
124
+ | `--config` | Display active configuration | `codefetch --config` |
125
+ | `--reset-config` | Reset configuration back to defaults | `codefetch --reset-config` |
126
+ | `-v`, `--version` | Display version information | `codefetch --version` |
127
+ | `-h`, `--help` | Display help and usage message | `codefetch --help` |
128
+
129
+ ---
130
+
131
+ ## Supported File Extensions
132
+
133
+ CodeFetch recognizes and lists common source and document files:
134
+
135
+ - **Data & Tables**: `.csv`, `.tsv`, `.json`, `.jsonl`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.cfg`, `.conf`, `.env`
136
+ - **Data Science**: `.ipynb`, `.py`, `.r`, `.rmd`, `.m`
137
+ - **Languages**: `.c`, `.cpp`, `.h`, `.hpp`, `.rs`, `.go`, `.java`, `.kt`, `.cs`, `.swift`, `.dart`, `.php`
138
+ - **Web**: `.html`, `.css`, `.scss`, `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`
139
+ - **Scripts & Systems**: `.sh`, `.bash`, `.zsh`, `.fish`, `.bat`, `.cmd`, `.ps1`, `.lua`, `.rb`, `.asm`, `.s`, `.hex`
140
+ - **Database & Schemas**: `.sql`, `.graphql`, `.gql`, `.proto`
141
+ - **Documentation**: `.md`, `.markdown`, `.rst`, `.txt`, `.tex`, `.log`
142
+ - **Build Files**: `Dockerfile`, `Makefile`, `CMakeLists.txt`, `Gemfile`, `Procfile`
143
+
144
+ ---
145
+
146
+ ## License
147
+
148
+ This project is licensed under the [MIT License](LICENSE).
@@ -2,4 +2,4 @@
2
2
  CodeFetch - CLI tool to fetch code files from GitHub repositories.
3
3
  """
4
4
 
5
- __version__ = "1.2.0"
5
+ __version__ = "1.2.2"