-
Notifications
You must be signed in to change notification settings - Fork 0
Commands Reference
| Command | Description |
|---|---|
snack list [category] |
List all snippets, optionally filtered by category |
snack search <keyword> |
Search snippet filenames for a keyword |
snack unpack <snippet> [--flat] [--force] |
Copy a snippet from the stash into the current directory |
snack pack <snippet> [--force] |
Copy a snippet from the current directory into the stash |
snack stash create <name> <path> |
Register a new named stash directory |
snack stash list |
List all configured stashes |
snack stash move <name> <new-path> |
Move a stash to a new location |
snack stash add-remote <repo> [--subdir] [--force] |
Copy snippets from a GitHub repo into the active stash |
All commands accept --help for inline usage information.
These commands operate on the active stash (set via snack stash create or the SNACK_STASH env var).
Lists all .py files in the stash, sorted alphabetically.
snack listOutput:
auth/google_oauth_fastapi.py
auth/google_oauth_flask.py
auth/jwt_helpers.py
forms/contact_form.py
forms/newsletter_signup.py
email/smtp_sender.py
Pass a category name (subdirectory) to narrow the output:
snack list authOutput:
auth/google_oauth_fastapi.py
auth/google_oauth_flask.py
auth/jwt_helpers.py
Searches snippet filenames (not file contents) for a keyword. Case-insensitive.
snack search oauthOutput:
auth/google_oauth_fastapi.py
auth/google_oauth_flask.py
Copies a snippet from the stash into the current working directory.
snack unpack auth/google_oauth_fastapi.pyThe path is relative to the stash root. Use snack list or snack search to find the correct path.
| Flag | Description |
|---|---|
--flat |
Copy the file directly into the current directory, discarding subdirectory structure |
--force |
Overwrite an existing file without prompting |
cd ~/projects/my-app
snack unpack auth/google_oauth_fastapi.py
# Creates: ./auth/google_oauth_fastapi.pysnack unpack auth/google_oauth_fastapi.py --flat
# Creates: ./google_oauth_fastapi.pyIf the destination file already exists:
'./auth/google_oauth_fastapi.py' already exists. Overwrite? [y/N]:
Pass --force to skip the prompt.
Copies a file from the current working directory into the stash. Use this when you have improved a snippet during a project and want to update the canonical version.
snack pack auth/google_oauth_fastapi.pyThe path is relative to the current working directory and is used as-is inside the stash.
| Flag | Description |
|---|---|
--force |
Overwrite an existing stash file without prompting |
Registers a new named stash directory and creates it on disk if it doesn't already exist.
snack stash create default ~/snack-stash
snack stash create work ~/work-stash
snack stash create work ~/work-stash --no-activateThe first stash created is automatically set as active. For subsequent stashes, use --activate (the default) to switch, or --no-activate to add without switching.
| Flag | Default | Description |
|---|---|---|
--activate / --no-activate
|
--activate |
Whether to set this as the active stash |
Shows all configured stashes with their paths, marking the active one.
snack stash listOutput:
default /Users/you/snack-stash ← active
work /Users/you/work-stash
If a stash path no longer exists on disk, it is flagged:
default /Users/you/snack-stash ← active [path missing!]
If SNACK_STASH env var is set, a note is shown at the bottom indicating it is overriding the active stash.
Moves a stash directory to a new location on disk and updates the path in ~/.snackstashrc.
snack stash move default ~/new-location/snack-stash- The old directory and all its contents are moved to the new path
- The config is updated automatically
- If the old path no longer exists on disk, the new directory is created instead
- Errors if the new path already exists (to prevent accidental overwrites)
Downloads a public GitHub repository as a tarball and copies all .py files into the active stash, preserving directory structure.
snack stash add-remote owner/repo
snack stash add-remote https://github.com/owner/repoOnly copy files from a specific subdirectory of the repo:
snack stash add-remote owner/repo --subdir authThis copies auth/google_oauth.py from the repo as auth/google_oauth.py in the stash (the full path is preserved).
| Flag | Description |
|---|---|
--subdir <dir> |
Only copy files under this subdirectory of the repo |
--force |
Overwrite existing stash files without prompting |
owner/repohttps://github.com/owner/repohttps://github.com/owner/repo.git
Non-Python files (.md, .txt, etc.) are never copied.