What is a plis tool?

A plis tool is a set of scripts and configuration files that are used by plis to create the cli interface. The simplest plis tool contains of only 2 files :

  1. A config file config.json
  2. A run script run.js,( the run script is different depending on the scripting language you use javascript is one of the currently supported scripting languages)
    config.json is the file that contains the configurations of your tool, this file will specify the scripting language you want to use, the name of the tool, flags, arguments, subcommands.

run.js will have the script that is run by plis, this script always must have a main() function that will be called by plis.v

"Hello World!" tool

A simple tool has this folder structure:

├── plis-hello/
│   └── test-project/
│   ├── .plis-generator.json
│   ├── config.json
│   ├── run.js

Every tool is located in a folder named plis-{tool-name}, this is a naming convention that is required for all tools.

  • .plis-tool.json is used for debugging, if plis is run inside the plis-hello folder it knows that it is being run within a tool and sets up debugging.
{
    "tool_name":"hello",
    "test_dir":"test-project"
}
  • config.json is used to keep all the tool configurations (name, flags, arguments, etc..)
{
    "name":"hello",
    "description":"This is the 'hello' plis tool",
    "script_type":"js"
}
  • run.js is the script that is run when the tool is called.
function main(){
    console.log("Hello World!")
}
  • test-project/ this folder is used when you are testing your tool, every time you run plis inside a tool folder the tool that is run thinks that test-project/ is the working directory, this allows you to test your tool when you have to deal with files read,write and templates.

Run your tool

Navigate to the tool folder and run

plis hello
Hello World!

To create more complex tools you will have to use plis API.