Tool config
The tool configurations contain information that plis uses to run the tool and to parse user input, the configurations are stored as a json and this are the possible configurations.
Config.json
{
"name": "hello",
"aliases": [
"hi",
"h"
],
"description": "Description.....",
"long_description": [
"Mulit line",
"Description ...."
],
"flags": [
{
"name": "type",
"short": "t",
"description": "The type",
"type": "string",
"default": "default"
}
],
"args": [
{
"name": "name",
"description": "The name",
"type": "string",
"required": true
}
],
"script_type": "lua",
"sub_commands": [
"new",
"add"
]
}
- name - the tool name this property is used when running your tool
plis {name}
- aliases - this property is used to specify aliases for your tool so instead running
plis hello
you can runplis hi
orplis h
and the result will be the same. - description and long_description- are used to describe what your tool is used for.
- flags - specify the flags that the user can use.
- args - specify the arguments the user can provide.
- script_type - is the script type used to write the tool.
- sub_commands - the tools sub commands.
Flags config
The flags config holds a list of flags, this will tell plis what flags are available for your tool.
{
"name":"myFlag",
"short":"m",
"description":"The flag description",
"type":"string",
"default":"defaultValue"
}
- short is used if you want to make it possible to set the flag by running
-m value
instead of--myFlag value
, it is just a way to make it simpler to set the flag value. - default is the default value of the flag, make sure that the default value has the same type as specified in the flag config.
Args config
The args config holds a list of arguments, this will tell plis what arguments the tool is accepting.
{
"name":"myArg",
"description":"The tool name",
"type":"string",
"required":true
}
Argument order
The arguments that are required are the first plis will map, this means that if you have 3 arguments for e.x
myarg:required, myarg1:not required, myarg2:required
plis will reorder the arguments tomyarg:required, myarg2:required, myarg1:not required
.
Updated almost 8 years ago