Updates readme for new version

This commit is contained in:
Dandaedre 2023-05-23 00:27:00 +02:00
parent b2ebab85a4
commit 9866cbc87d
2 changed files with 45 additions and 13 deletions

3
.gitignore vendored
View File

@ -21,4 +21,5 @@ Cargo.lock
/target
/coverage
/llvm
tarpaulin-report.html
tarpaulin-report.html
!coverage/html/badges/flat.svg

View File

@ -1,29 +1,60 @@
# snp
# SNP : A (simple) Code Snippet Manager
![coverage/html/badges/flat.svg](coverage/html/badges/flat.svg)
<img src="https://proxy.dandaedre.com/gitea/repo-avatars/30-fed01296b47bdd2e84f8f0a1a96e4094" alt="drawing" width="140" align="right"/>
A simple cli utility to manage snippets, while it was created to be used with Helix, it can work with any tool integrating input from stdout
## Usage
```sh
To create a new snippet and edit it immediately
$ snp snippet_name -c -e list of default tokens
### Create and Edit Snippet
To edit the content of a 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.
To edit the whole snippet (allow for editing of name and list of args)
### 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.
To delete a 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 .
To use a snippet
### 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 reasons too long to explain here, test must be run with the optional feature ``--feature "test"`.
Failure to do so will result in the editor popping in during tests.
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.