You can upload snippets to your lab books using the CLI. This is mainly a quality of life feature to make it easier to upload snippets without writing curl commands. This expects a valid token to be available, see Token Management for more information.
At the moment the snippet subcommand is barebones. We plan to add more features in the future if there is demand for it.
All commands related to tokens are available under the snippet subcommand.
snip snippetUsage: snip snippet [OPTIONS] COMMAND [ARGS]...Upload or validate snippets.╭─ Options ────────────────────────────────────────────────────────────────────╮│--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Commands ───────────────────────────────────────────────────────────────────╮│upload Upload a snippet to a snip instance. ││validate Validate a snippet. ││preview Preview a snippet. │╰──────────────────────────────────────────────────────────────────────────────╯
To validate a snippet you may use the snippetvalidate command. This checks if a snippet is valid and can potentially be uploaded.
snip snippet validateUsage: snip snippet validate [OPTIONS] FILEValidate a snippet.╭─ Arguments ──────────────────────────────────────────────────────────────────╮│*fileFILENAMEThe file json file upload.[required]│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Options ────────────────────────────────────────────────────────────────────╮│--deployment-dTEXTThe deployment URL i.e. the URL of the snip ││instance. ││[default: ││https://snip.roentgen.physik.uni-goettingen.de/]││--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯
This check is only performed locally and does not require a token.
To generate a preview of the snippet you may use snippetpreview. This will open a window with the rendered snippet.
snip snippet previewUsage: snip snippet preview [OPTIONS] FILEPreview a snippet.╭─ Arguments ──────────────────────────────────────────────────────────────────╮│*fileFILENAMEThe file json file upload.[required]│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Options ────────────────────────────────────────────────────────────────────╮│--validate-vValidate the snippet before uploading it.││[default: True] ││--token-tTEXTThe token to use if none is give, the token is ││read from the keyring or files and is ││automatically matched top the given snippet. ││--deployment-dTEXTThe deployment URL i.e. the URL of the snip ││instance. ││[default: ││https://snip.roentgen.physik.uni-goettingen.de/]││--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯
To upload a snippet you may use the snippetupload command. This will upload the snippet to the lab book and it can be placed using the editor.
snip snippet uploadUsage: snip snippet upload [OPTIONS] FILEUpload a snippet to a snip instance.╭─ Arguments ──────────────────────────────────────────────────────────────────╮│*fileFILENAMEThe file json file upload.[required]│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Options ────────────────────────────────────────────────────────────────────╮│--validate-vValidate the snippet before uploading it.││[default: True] ││--token-tTEXTThe token to use if none is give, the token is ││read from the keyring or files and is ││automatically matched top the given snippet. ││--deployment-dTEXTThe deployment URL i.e. the URL of the snip ││instance. ││[default: ││https://snip.roentgen.physik.uni-goettingen.de/]││--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯