cli_scripts - How to write and execute Sncode scripts from the command line.
It is recommended to execute Sncode scripts from the command line whenever you have to run:
Create a simple file called test.sn
:
{{ a = "Hello World"; a; }}
As you can see, there is no difference between a CLI script and one that is executed in the browser.
The simplest way:
sncode test.sn
When you have to specify the full path to your script (recommended):
sncode /path/to/your/script/test.sn
When there is no alias for the "sncode" command:
/usr/local/bin/sncode test.sn
When your script requires a specific project configuration file (e.g., for database access):
sncode /full/path/to/your/test.sn -c /path/to/your/config/project_name.conf
The simplest way:
sncode -e /path/to/your/script.snc
When your script requires a specific project configuration file (e.g., for database access):
sncode -e /path/to/your/script.snc -c /path/to/your/config/project_name.conf
You may execute this command to get all available options:
sncode -h
Written by Jean-Georges Guenard, <jg@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com