CLI to browse and fetch code snippets from GetSomeSleepBro/codes via GitHub API
Project description
getcode (gc) — fetch code from GetSomeSleepBro/codes without cloning
Overview
- Simple, intuitive CLI to browse and fetch code from the GitHub repo online (no full clone).
- Defaults to latest version when multiple implementations (v1, v2, …) exist.
- Stdlib-only (urllib); optional GitHub token to avoid rate limits.
Install
- pip install getcodes
- Console scripts:
getcodeandgc.
Config
- Env vars:
GETCODE_REPO(default:GetSomeSleepBro/codes)GETCODE_BRANCH(default:main)GITHUB_TOKEN(optional; increases rate limits)
Basic Use
- List subjects:
gc subjects
- Quick shorthand:
gc dbms→ list DBMS codesgc dbms ddl→ fetch best match for "ddl" in DBMS (copy/save based on default)gc DSA/v3/B6_BSTops.cpp→ fetch by repo path
- List codes in a subject (latest version by default):
gc list DSAgc list CNS --ext .py(only Python)gc list DBMS --all-versions --full-path
- Show summary info:
gc info(totals and latest version per subject)gc info --subject DSA --all-versions
- Search filenames across subjects:
gc search bst --ext .cppgc search tcp --subject CNS
- Fetch by repo path:
gc get DSA/v3/B6_BSTops.cpp --to ./codes
- Fetch by subject + pattern or exact name (simple):
gc get dbms ddl(best match in DBMS)gc get cns sliding_window.py(exact name in CNS)
- Fetch by subject + name (chooses latest version if multiple):
gc get -s DSA -n B6_BSTops.cpp --to ./codesgc get -s DSA -n B6_BSTops.cpp -v v2(specific version)
- Fetch by subject + pattern (picks best match):
gc dsa bst(shorthand; default action applies)gc get -s DSA -m bst --to ./codes- Copy instead of saving:
gc dsa bst --copy(shorthand)- or
gc get -s DSA -m bst --copy
- Flatten save path (avoid nested folders):
gc get DSA/v3/B6_BSTops.cpp --flatten
Notes
- Version folders appear only when multiple implementations exist. The CLI shows only the latest by default; use
--all-versionsto see others. - Listing recurses into nested folders (e.g.,
CNS/programs,DBMS/sql). - If saving multiple files with
--flattenand names collide, the CLI appends a suffix (e.g.,-v3). - Network errors or API rate limits print a friendly hint to set
GITHUB_TOKEN. - Automatic fallback: if the GitHub API is rate-limited/unavailable, the CLI downloads a temporary ZIP snapshot of the repo and serves listings/reads from it. The snapshot lives in a temp folder and is cleaned up automatically at process exit (including Ctrl+C).
Clipboard
- Copy text directly: add
--copy(or-c) togc getwhen fetching a single file. - Make copy the default action instead of saving files:
export GETCODE_DEFAULT_ACTION=copy
- Clipboard uses built-in OS tools (macOS
pbcopy, Windowsclip) or stdlibtkinterwhen available.
Help
gc helpshows quick examples and tips right in the terminal.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
getcodes-0.1.0.tar.gz
(16.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
getcodes-0.1.0-py3-none-any.whl
(15.1 kB
view details)
File details
Details for the file getcodes-0.1.0.tar.gz.
File metadata
- Download URL: getcodes-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1561b7d3b3cf867ad5ff6c54028f65b5a8a7f06faf60aeaf9ad51c4e29a6f286
|
|
| MD5 |
2f67df4d6bc80fef4fba893aa937c741
|
|
| BLAKE2b-256 |
018d108ce856af0ce1a8ebb7dbe2d98c77f1551cf0912a2a9133c75abe175043
|
File details
Details for the file getcodes-0.1.0-py3-none-any.whl.
File metadata
- Download URL: getcodes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d6cbba2bb69bbf1d77743ed8f17bb8fc4b35f2ced1f6032449a2851f89f8cd0
|
|
| MD5 |
7f14c57e876ec8068f55f7418b3ea867
|
|
| BLAKE2b-256 |
c9f47b30077fe383a212239bf371725ef54e0dd06fcb5d884ac88726ac891ee3
|