There are several ways to get started with the CloudSlang CLI.
Prerequisites : To run the CloudSlang CLI, Java JRE version 7 or higher is required.
- Download the CLI zip file.
- Locate the downloaded file and unzip the archive.
The decompressed file contains:
- A folder named cslang with the CLI tool and its necessary dependencies.
- A folder named content with ready-made CloudSlang flows and operations.
- A folder named python-lib.
- Navigate to the folder
cslang-cli\cslang\cslang\bin\
. - Run the executable:
- For Windows :
cslang.bat
. - For Linux :
bash cslang
.
Prerequisites : To build the CloudSlang CLI, Java JDK version 7 or higher and Maven version 3.0.3 or higher are required.
- Git clone (or GitHub fork and then clone) the source code.
- Using the Command Prompt, navigate to the project root directory.
- Build the project by running
mvn clean install
. - After the build finishes, navigate to the
cloudslang-cli\target\cloudslang\bin
folder. - Run the executable:
- For Windows :
cslang.bat
. - For Linux :
bash cslang
.
Prerequisites : To download the package, Node.js is required. To run the CloudSlang CLI, Java JRE version 7 or higher is required.
- At a command prompt, enter
npm install -g cslang-cli
.- If using Linux, the sudo command might be neccessary:
sudo npm install -g cslang-cli
.
- If using Linux, the sudo command might be neccessary:
- Enter the
cslang
command at any command prompt.
When a flow is run, the entire directory in which the flow resides is
scanned recursively (including all subfolders) for files with a valid
CloudSlang extension. All of the files found are compiled by the CLI. If
the --cp
flag is used, all of the directories listed there will be
scanned and compiled recursively as well.
The usage of forward slashes (/
) in all file paths is recommended
even on Windows.
To run a flow or operation located at c:/.../your_flow.sl
, use the
--f
flag to specify the location of the flow to be run:
cslang>run --f c:/.../your_flow.sl
If the flow or operation takes in input parameters, use the --i
flag
and a comma-separated list of key=value pairs:
cslang>run --f c:/.../your_flow.sl --i input1=root,input2=25
Commas (,
) can be used as part of input values by escaping them with
a backslash (\
).
cslang>run --f c:/.../your_flow.sl --i list=1\,2\,3
To use inputs that include spaces, enclose the entire input list in
quotes ("
):
cslang>run --f c:/.../your_flow.sl --i "input1=Hello World, input2=x"
Double quotes ("
) can be used as part of quoted input values by
escaping them with a backslash (\
). When using a quoted input list,
spaces between input parameters will be trimmed.
To pass the value "Hello" World to a flow:
cslang>run --f c:/.../your_flow.sl --i "input1=\"Hello\" World"
Alternatively, inputs made be loaded from a file. Input files are written in flat YAML, containing a map of names to values. Input files end with the .yaml or .yml extensions. If multiple input files are being used and they contain an input with the same name, the input in the file that is loaded last will overwrite the others with the same name.
Example - inputs file
input: hello
input_list:
- one
- two
- three
input_map:
one: a
two: b
three: c
Input files that contain inputs
in their name can be loaded
automatically if placed in a folder named inputs
in the directory
from which the CLI is run. If the flow requires an input file that is
not loaded automatically, use the --if
flag and a comma-separated
list of file paths. Inputs passed with the --i
flag will override
the inputs passed using a file.
cslang>run --f c:/.../your_flow.sl --if c:/.../inputs.yaml --i input1=value1
Dependencies from the content folder packaged with the CLI are added to
the classpath by default. If the flow requires dependencies from another
location, use the --cp
flag with a comma-separated list of
dependency paths. Note that explicitly declaring a classpath using
--cp
overrides the default classpath, and therefore if there also is
a dependency in the content folder, the folder must be added to the
classpath explicitly.
cslang>run --f c:/.../your_flow.sl --i input1=root,input2=25 --cp c:/.../yaml
System properties files are written in flat YAML, containing a map of names to values. System property files end with the .yaml or .yml extensions. If multiple system properties files are being used and they contain a system property with the same fully qualified name, the property in the file that is loaded last will overwrite the others with the same name.
Example - system properties file
examples.properties.text: hello
examples.properties.list:
- one
- two
- three
examples.properties.map:
one: a
two: b
three: c
System property files can be loaded automatically if placed in a folder
named properties
in the directory from which the CLI is run. If the
flow or operation requires a system properties file that is not loaded
automatically, use the --spf
flag and a comma-separated list of file
paths.
cslang>run --f c:/.../your_flow.sl --spf c:/.../yaml
Normally a flow's task names are printed to the screen as they are run.
To disable the task names from being printed, use the --q
flag.
cslang>run --f c:/.../your_flow.sl --q
A flow can be run without first starting up the CLI using the non-interactive mode.
From a shell prompt:
cslang>run --f c:/.../your_flow.sl
Some of the available commands are:
env --setAsync
- Sets the execution mode to be synchronous (false
) or asynchronous (true
). By default the execution mode is synchronous, meaning only one flow can run at a time.
cslang>env --setAsync true
inputs
- Lists the inputs of a given flow.
cslang>inputs --f c:/.../your_flow.sl
cslang --version
- Displays the version of score being used.
cslang>cslang --version
The execution log is saved in the directory in which the CLI was started
at logs/execution.log
. The log file stores all the
events that have been fired, and
therefore it allows for tracking a flow's execution.
To get a list of available commands, enter help
at the CLI
cslang>
prompt. For further help, enter help
and the name of the
command.