61 lines
2.4 KiB
Markdown
61 lines
2.4 KiB
Markdown
# SNP : A (simple) Code Snippet Manager
|
|
|
|

|
|
<img src="https://proxy.dandaedre.com/gitea/repo-avatars/30-fed01296b47bdd2e84f8f0a1a96e4094" alt="drawing" width="140" align="right"/>
|
|
|
|
## Usage
|
|
|
|
### Create and Edit Snippet
|
|
|
|
To create a new snippet and edit its content immediately, use the following command:
|
|
```
|
|
$ snp snippet_name -c -e list_of_default_tokens
|
|
```
|
|
Replace `snippet_name` with the desired name for your snippet and provide a space-separated `list_of_default_tokens` that you want to include in the snippet. This command will create the snippet and open the editor for you to modify its content.
|
|
|
|
### Edit Snippet Content
|
|
|
|
To edit the content of an existing snippet, use the following command:
|
|
```
|
|
$ snp snippet_name -e
|
|
```
|
|
Replace `snippet_name` with the name of the snippet you want to edit. This command will open the editor for you to modify the content of the specified snippet.
|
|
|
|
### Edit Whole Snippet
|
|
|
|
To edit the entire snippet, including its name and list of arguments, use the following command:
|
|
```
|
|
$ snp snippet_name -E
|
|
```
|
|
Replace `snippet_name` with the name of the snippet you want to edit. This command will open the editor for you to modify the name, content, and arguments of the specified snippet.
|
|
|
|
#### Wonky Not definitive behaviour
|
|
|
|
- If you change the name of the snippet this way, the snippet will not be saved under a different name, this behaviour will change very soon
|
|
- If you mess up in any way, the snippet manager will save your work under `snippet_name.bad.yaml`
|
|
|
|
### Delete Snippet
|
|
|
|
To delete a snippet, use the following command:
|
|
```
|
|
$ snp snippet_name -d
|
|
```
|
|
Replace `snippet_name` with the name of the snippet you want to delete. This command will remove the specified snippet from the snippet folder .
|
|
|
|
### Use Snippet
|
|
|
|
To use a snippet, simply execute the following command:
|
|
```
|
|
$ snp snippet_name
|
|
```
|
|
Replace `snippet_name` with the name of the snippet you want to use. This command will execute the specified snippet.
|
|
|
|
## Testing
|
|
|
|
For testing purposes, it is important to run tests with the optional feature `--feature "test"`. Failing to include this feature may cause the editor to pop up during tests. To run tests, use the following command:
|
|
```
|
|
$ cargo test --feature "test"
|
|
```
|
|
Make sure to include the `--feature "test"` option to ensure smooth testing without interruptions from the editor.
|
|
|