Skip to main content
Skip table of contents

Scripting (How-to guide)

You are able to pass scripts as an input to CleverMaps Shell.

The script may contain command sequences equal to those you put in through the standard input.

The script file must be located in the working directory of the Shell, and it must be a text file. The name of this text file is passed to Shell as a command line argument  --cmdfile.

Example

We have the following directory structure:

CODE
./
../
cm_shell.sh
cm-shell-2.0.2-RELEASE-exec.jar
script.txt

The contents of script.txt are the following:

CODE
login --server https://secure.clevermaps.io
openProject --project abcdefgh12345678
loadCsv --file /home/user/CAN/orders.csv --dataset orders --mode incremental
loadCsv --file /home/user/CAN/customers.csv --dataset customers --mode incremental
dumpCsv --dataset stores
exit

By default, the running script (in this case, can_shell.sh) does not contain the --cmdfile argument. So unless you add it there, you will have to run the Shell like this:

CODE
java -jar cm-shell-2.0.2-RELEASE-exec.jar --cmdfile script.txt

If the script file exists and is valid, it is executed.

Exit code

Shell supports classic exit code behaviour.

If the script passes, the exit code of the process is 0. If a command fails, the execution is aborted, and the exit code is 1. 

This is usable in automated environments, in combination with other scripts, etc.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.