DEV Community

YJDoc2
YJDoc2

Posted on

Shnippet : minimal shell snippet manager made in Rust

Hey!
After searching for a shell command on the net to quickly do something, you probably make a proper script file out of it, then save it on a folder on your path and then remember what you named it so that when you need it again, you can directly execute it, right?
Yeah...me neither 😅 😄

I was recently trying to find a solution for a problem with my usb port, and on stack overflow I found a solution for it which worked! Unfortunately it didn't seem to fix it permanently, and I had to do it again after booting to make it work.

Now feeling a bit lazy, I didn't create a shell script from it, and put it on the path so I can execute it again quickly, but I also didn't want to go to the stackoverflow every time I boot and the copy paste it.

Thus, having a bit of time, and not doing anything in rust for a while, I created Shnippet : a commandline shell snippet manager. It gives a quick way to save, edit and even run the snippets right from the commandline, and creates all .sh files for you. It also saves names and descriptions of the snippets, so you can check why did you save what you did save.

The interface is quite simple :

USAGE:
    shnippet [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    delete  <name>    Delete an existing shnippet
    edit    <name>    Edit an existing shnippet
    exec    <name>    Run a shnippet in shell
    help              Prints this message or the help of the given subcommand(s)
    list              List all shnippets
    new               Add new shnippet

Enter fullscreen mode Exit fullscreen mode

Also it saves all of the snippets in .sh files, so you can easily make a backup, copy same snippets on various machines or port them to something else if needed.

let me know if you found this useful in comments, and star it on github if you did 😄

GitHub logo YJDoc2 / shnippet

A commandline shell snippet manager

Shnippet


A minimal commandline shell snippet manager. [With a minimal readme.]

What is this?

Sometimes we have to do some quick command execution which we search off the net, and even though we use it many times, we don't want to create a script for it, manage the script folder, put it on path etc. Shnippet is a commandline manager which does all that for you, and you only have to give a name, description and the command/script. It can also execute a shnippet with a command PRs and issues are welcome.

USAGE
    shnippet [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    delete  <name>    Delete an existing shnippet
    edit    <name>    Edit an existing shnippet
    exec    <name>    Run a shnippet in shell
    help              Prints this message or the help of the
Enter fullscreen mode Exit fullscreen mode

Thank you!

Top comments (0)