Pline plugin API

For describing command-line interfaces, Pline defines an application programming interface (API) specification based on JSON standard. JSON (JavaScript Object Notation) is a common format for representing structured data in human-readable text \cite{json}. A Pline web application can include one or more Pline plugins – CLI programs and their JSON descriptions stored in text  files. These files inform Pline on how to launch the underlying program as well as how to draw its user interface.
With the plugin API,  a CLI program is defined using a list of valid command-line arguments, where each argument is described with property/value pairs and grouped with nested brackets. Pline utilizes this notation to effectively describe interactive GUIs: the data (a set of properties with values) defines the underlying functionality, while its structure (the order and nesting of parameters) reflects the placement of resulting interface elements. Since most of the API properties are optional, basic interfaces are quick to construct. The only compulsory data fields are the executable name and the type (or name) of each input argument. A simple example is shown in Figure \ref{477555}. Here, the JSON description specifies a python script that expects an input file (as a positional argument), followed by a boolean flag named "--count" and a text input called "--out" (both optional, named arguments). Using Pline API, this information is presented with a compact piece of JSON: {"file": ""}, {bool: "--count"}, {"text": "--out"}. The rest of the properties shown in the figure specify optional functionality. For example, "required" adds a check for filling the file input and the accompanying error message, while "title""default" and "desc" will display relevant information in specific places in the resulting interface.
Input arguments are often related. The set of valid arguments, their expected values, and the interpretation of (even the same) values by a command-line program may change depending on how the user has filled some other, related input argument. In the Pline JSON format, the network of linked inputs1 is described by setting rules for the input properties that support it. For example, instead of a fixed default value for an input, a rule can derive the value from another input. These rules are written as conditionals – English-like if-else sentences (or alternatively, JavaScript statements), where the action of the rule is defined by the property that the rule is attached to. To illustrate, the static "default" property of the --out parameter in Figure \ref{477555} could be replaced with a dynamic one: "default": "'foo.txt' if count, else 'bar.txt'". This rule would swap the default parameter value (and show it in the text input) depending on whether the checkbox element (controlling the --count parameter) is ticked. In addition to setting the default value, Pline supports conditionals for dynamically formatting or fixing an input value, for specifying an output file name and for enabling or disabling input elements and element groups. Together with other advanced features like input filters, error messages and merged values, the Pline API allows for describing even highly complex command-line interfaces. To customize the resulting GUI, the API also specifies properties for adding icons, labels, documentation, HTML markup and CSS rules.
When used on its own, the term input refers to a CLI program argument and its representation in the JSON, the  GUI, and the command-line form (see Figure 1).