Parameters
To support snippet parameters, SnipKit requires special parameter syntax in your scripts.
Info
The parameter syntax used by SnipKit ensures that your scripts remain fully functional even when not executed via SnipKit. All parameter information is described through comments, making it a consistent way to document your scripts.
Tip
SnipKit Assistant helps you write snippets using the correct parameter syntax.
Parameter Names & Descriptions
Example snippet | |
---|---|
1 2 3 4 |
|
Each comment which corresponds to a variable starts with # ${<varName>}
with <varName>
referring to the variable name
used in your script (e.g., VAR1
in the example).
- Line 1 is ignored by SnipKit since it does not adhere to this pattern.
- Line 2 defines the name of the parameter as displayed by SnipKit when presenting you parameter input form.
- Line 3 describes the usage of the parameter. As of now, the description will be used as a placeholder value for an empty parameter input field.
- Line 4 uses the parameter. It does not correspond to the parameter syntax and belongs to your script.
Default parameter name and type
If you don't specify a parameter name, the name of the variable will be used instead, e.g., VAR1
in the example.
In case you don't provide a type (e.g., PASSWORD
or PATH
- see below), the default is TEXT
Default Values
You can define a default value for each parameter:
Example snippet with a parameter default value | |
---|---|
1 2 3 |
|
This way, the input field for parameter VAR1
will be automatically filled with Hello World
.
Pre-defined values
You can add multiple pre-defined values for a parameter in order to ease filling the input form:
Example snippet with pre-defined values for a parameter | |
---|---|
1 2 3 4 |
|
The example defines the values One + some more
, "Two"
, Three
, Four, and some more
, and Five
. Empty pre-defined
values will be omitted.
You can define multiple lines starting with ${<varname>} Values:
to list pre-defined values. The listed values will be
joined by SnipKit. Each value must be seperated by the next via the character ,
.
Attention
If the value contains a comma itself, it needs to be escaped via \,
.
Passwords
A parameter can be marked to be a password. In this case, the actual characters of the input will be masked.
Example snippet with a PASSWORD parameter | |
---|---|
1 2 3 |
|
Marking the parameter PW
as password happens in line 2 by defining Type: PASSWOPRD
.
Paths
Often, parameters are a path to a file or a directory. In this case, SnipKit is able to provide you with autocomplete suggestions:
Example snippet with a PATH parameters | |
---|---|
1 2 3 |
|
Marking the parameter PW
as password happens in line 2 by defining Type: PASSWOPRD
.