Snippets

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 snippet Usage: 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.                                                ╰──────────────────────────────────────────────────────────────────────────────╯

Validate Snippets

To validate a snippet you may use the snippet validate command. This checks if a snippet is valid and can potentially be uploaded.

snip snippet validate Usage: snip snippet validate [OPTIONS] FILE Validate 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.

Preview Snippets

To generate a preview of the snippet you may use snippet preview. This will open a window with the rendered snippet.

snip snippet preview Usage: snip snippet preview [OPTIONS] FILE Preview 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. ╰──────────────────────────────────────────────────────────────────────────────╯

Upload Snippets

To upload a snippet you may use the snippet upload command. This will upload the snippet to the lab book and it can be placed using the editor.

snip snippet upload Usage: snip snippet upload [OPTIONS] FILE Upload 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. ╰──────────────────────────────────────────────────────────────────────────────╯