https://github.com/spenserblack/snippit
Define, store, and output your code snippets
https://github.com/spenserblack/snippit
code-snippet code-snippets snippet snippets
Last synced: 9 months ago
JSON representation
Define, store, and output your code snippets
- Host: GitHub
- URL: https://github.com/spenserblack/snippit
- Owner: spenserblack
- Created: 2022-12-13T22:11:47.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T01:40:38.000Z (over 1 year ago)
- Last Synced: 2025-04-04T13:12:15.208Z (9 months ago)
- Topics: code-snippet, code-snippets, snippet, snippets
- Language: Ruby
- Homepage: https://spenserblack.github.io/snippit/
- Size: 69.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snippit
[](https://badge.fury.io/rb/snippit)
[](https://github.com/spenserblack/snippit/actions/workflows/ci.yml)
[](https://github.com/spenserblack/snippit/actions/workflows/github-code-scanning/codeql)
[](https://codecov.io/gh/spenserblack/snippit)
Define, store, and output your code snippets.
## Usage
All uses of `snippit` can be replaced with the shortcut `snip`.
```console
# Define a snippet called "hello-world.js"
$ snippit --save hello-world.js
# Set the slug and descriptive name of the snippet
$ snippit --save hello-world.js --slug hw-js --name "JavaScript Starter"
# Output the "JavaScript Starter" snippet to a file called "index.js"
$ snippit --get hw-js > index.js
# List all of your code snippets
$ snippit --list
```
## How it works
Code snippets get stored in a directory called `.snippit` in your home
directory. The actual code snippet filenames are slugified versions of the
snippet name. `.__definitions__.yml` is a reserved filename, as it is used to
map snippet slugs (filenames) to their human-readable names.