It allows users to quickly retrieve and insert commonly used code snippets into their current projects, saving time and effort.
Sometimes situations arise when we have to reuse code in a different project, and would have been better if they were saved somewhere and can be accessed easily. This CLI tool aims to do exactly that.
Usage:
my-snippets [command]
Download the my-snippets executable file and export the path in your PATH variable
-
From the directory the my-snippets is saved run the following cmd
pwd
-
Run the command
export PATH=$PATH:/full/path/to/your/directory
to add the directory to the PATH variable.export PATH=$PATH:/full/path/to/your/directory
-
Verify that the directory has been added to the PATH variable by running
echo PATH
A CLI snippet manager that allows you to manage your code snippets from the command line
Usage:
my-snippets [flags]
my-snippets [command]
Available Commands:
add
Add a new code snippet
completion
Generate the autocompletion script for the specified shell
get
get existing code snippet
help
Help about any command
list
list all existing code snippet
rm
Remove code snippet
Flags:
-h, --help
help for my-snippets
Use my-snippets [command] --help
for more information about a command.
Initially we thought to build a VS code extension tool which if enabled can create code snippets very quickly. We used Javascript yo template to generate a VS code extension. Although we were able to obtain the text which is selected in VS code and set it into clipboard, we were unable to add it as a VS code snippet.
So we tried a Golang CLI approach by using BoltDB to store the snippets locally.
In future, we plan to make the extension work and also host the golang as a backend server and facilitate code sharing between developers.