However, the description is
extendable with advanced inputs and properties for sophisticated GUIs.
Pline supports both simple input types like text, files, checkboxes or
selection lists, and advanced ones that merge or modify values from
linked inputs (see Figure \ref{890860} for an advanced case).
Input arguments are often related. A CLI program may require one or more
sets of arguments where the list of compulsory or optional arguments,
their values or the effect of those values is defined by the user input
for a set of other arguments. In the Pline JSON format, the network of
linked inputs 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 Javascript
statements where the action of the rule is defined by the property that
the rule is attached to. 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 interface, the API also specifies properties for
adding icons, labels, documentation, HTML markup and CSS rules.
Interface rendering
Pline includes an interface generator that implements the JSON
specification and translates the program description into a graphical
user interface. The generator is written in JavaScript, which runs
natively inside any modern web browser, and is used by including it in a
webpage as a library. The library takes a Pline plugin description as
input (given as raw JSON text or a URL), parses the information into an
internal data model, and outputs a graphical interface that can be
placed into any container element in a web page. In practice, the
process involves just two Javascript commands (addPlugin()
for the
plugin import, plugin.draw()
for interface drawing) and supports
multiple input programs and output interfaces in a single web page.
A Pline-generated GUI is not static – the HTML interface is bound to an
internal data model and event listeners that enforce the dependency
rules between the program parameters and adjust the interface according
to user interactions. User input is tracked in real-time: as soon as a
tick-box is clicked or a number is typed, the interface updates
accordingly, e.g. by hiding, revealing, or changing the values of all
the linked input elements. The conditionals in the Pline JSON therefore
provide a quick way to construct sophisticated interfaces that hide
invalid inputs and guide the user through program configuration options.
In addition to generating standalone GUIs, Pline can chain multiple
interfaces together, forming a pipeline – a set of commands executed in
succession. The information about input and output files in the program
description is used to control the data flow between the pipeline steps.
The current state of a single interface or a full pipeline can be stored
to a file and distributed as a reusable Pline pipeline with pre-filled
input values.
A graphical interface generated with Pline records user input and forms
a complete terminal command for launching the CLI program or pipeline
together with user-supplied input files. Since the web browser security
sandbox prevents direct command-line access, the program launch data is
passed on to a backend server for execution. Pline includes a
lightweight python script that acts as a server module to launch the
commands, either on a local computer or over the web. The Pline server
accepts the command data sent by the interface via an HTTP POST request,
sanitizes the input, and manages the execution process. It also supports
HTTP requests to send execution status updates back to the interface,
pause, cancel or resume running pipelines, or send email notifications
after a command or pipeline has finished.
Pline interfaces are designed to be installation-free and work across
many different operating systems. The JSON program description files are
platform-agnostic, the interface generator runs on any device with a
modern web browser (including mobile devices), and the server module
supports both Python 2.7 and 3 environments (which is preinstalled on
most MacOS and Linux systems). However, command-line executables are
compiled to run on a specific operating system, so a Pline plugin should
include an executable for each target system.