-
Notifications
You must be signed in to change notification settings - Fork 0
Script Arguments
The script receives its arguments in the form of flags, both short and long. You can display the help from the console with the -h, --help flag.
Most of the flags expect an argument value, while others don't. Mandatory arguments to long options are mandatory for short options too.
Syntax ↑
You can write the short argument flags either connected or separated. It's also possible to join a value to its previous flag:
webera -t -L 2webera -tL2
But remember that values must be always separated from the next flag:
-
# Wrongwebera -L2t webera -L2 -t
Long flags must be always separated from other flags with whitespace. And when they have an argument, they must separate it with an equal sign =, and nothing more:
webera --process-templates --log-level=2webera --log-level=2 --process-templates
Usage Examples ↑
The following examples demonstrate common usage situations, featuring both long and short flags.
- Process the templates, and write a level-2 logfile, after clearing any previous log:
webera --process-templates --clear-log --log-level=2
webera -t -cL2
- Process both the templates and the resources, and then preview using a custom browser:
webera --process-all --preview --browser-bin=vivaldi
webera -awW vivaldi
- Process resources from a custom resources directory to a custom output directory, with spaces in the path:
webera --process-resources --dir-resources=resB/ --dir-output="out B"
webera -rR resB/ -O "out B"
- Generate a new config file using the provided name, and write there the custom settings for the server and port.
webera --new-config --file-config=conf/webera.conf --server-type=php --server-port=8080
webera -nF conf/webera.conf -S php -P 8080
List of Flags ↑
Operative ↑
Using at least one operative flag is required in order for the script to do something.
The operative flags can not be configured in a file or config string. They can only be used as a script argument.
-t, --process-templates ↑
Process the templates.
By default it takes the templates from the tem/ directory.
You can use another directory with the -T, --dir-templates flag.
-r, --process-resources ↑
Process the resources.
By default it takes the resources from res/.
You can use another directory with the -R, --dir-resources flag.
-a, --process-all ↑
Process both the templates and the resources.
-w, --preview ↑
Preview the website in the web browser.
For that it will use the current server settings.
-n, --new-config ↑
Generate a new configuration file.
This option wont overwrite a previously existing file. In order to do that you must manually delete it first.
Configuration ↑
-F, --file-config=<FILE> ↑
Indicate the configuration file for the project.
-
Value:
<FILE>must be a path to file desired to be used as configuration.When using the
-n,--new-configflag, this will be the path of the newly created config file. -
Default value:
.weberarc -
Related info: Configuration: order of priority
-C, --config=<STRING> ↑
Pass some configuration as a string.
- Value:
<STRING>must be a text string with the same format and restrictions as the configuration present in a file, and loadable with the-F,--file-configflag. - Default Value: nothing
- Related info: Configuration: order of priority
Directories ↑
-T --dir-templates=<DIR> ↑
Indicate the templates directory.
- Value:
<DIR>must be a valid path to a directory. - Default value:
tem/ - Config variable:
DIR_TEMPLATES
-R, --dir-resources=<DIR> ↑
Indicate the resources directory.
- Value:
<DIR>must be a valid path to a directory. - Default value:
res/ - Config variable:
DIR_RESOURCES
-O, --dir-output=<DIR> ↑
Indicate the output directory.
The output directory will be deleted first, unless the -d, --dont-delete-output flag is used.
- Value:
<DIR>must be a valid path to a directory. - Default value:
out/ - Config variable:
DIR_OUTPUT
-B, --dir-build=<DIR> ↑
Indicate the build directory.
- Value:
<DIR>must be a valid path to a directory. - Default value:
build/ - Config variable:
DIR_BUILD
-d, --dont-delete-output ↑
Don't delete the output directory.
Avoids deleting the output directory before processing the templates and/or the resources.
Logging ↑
-L, --log-level=<NUMBER> ↑
Indicate the log level.
The higher the number the more info will be dumped into the log file. 0 means no info will be logged.
NOTE: Warnings and errors are always outputted to STDERR.
- Value:
<NUMBER>must be a number between 0 and 3. - Default value:
0 - Config variable:
OPTION_LOG_LEVEL
-G, --log-file=<FILE> ↑
Indicate a new path for the log file.
If the file exists, the log will be appended to it, unless the -c, --clear-log flag is used.
- Value:
<FILE>must be a file path. - Default value:
log.txt - Config variable:
LOG_FILE
-c, --clear-log ↑
Clears the log file.
If the log file already exists, clears the contents before starting to write the log.
Server ↑
-W, --browser-bin=<BIN> ↑
Indicate the web browser binary to use for previewing.
- Value:
<BIN>must be a valid binary in path for running the browser.
E.g.: chromium-browser, google-chrome, opera, vivaldi, elinks... - Default value:
firefox - Config variable:
WEB_BROWSER
-S, --server-type=<TYPE> ↑
Choose the supported type of server to use for previewing.
- Value:
<TYPE>must be a supported server type. (See table below) - Default value:
python - Config variable:
SERVER_TYPE
| Server Type | Description |
|---|---|
python |
Use python's built-in server |
php |
Use php's built-in server |
none |
Don't use any server |
custom |
Use the custom commands set in SERVER_START and SERVER_STOP config variables |
-H, --server-host=<HOST> ↑
Indicate the server host.
- Value:
<HOST>must be a valid domain name or IP. - Default value:
localhost - Config variable:
SERVER_HOST
-P, --server-port=<PORT> ↑
Indicate the server port number.
- Value:
<PORT>must be a valid port number, between 1 and 65535. - Default value:
8192 - Config variable:
SERVER_PORT
Other ↑
-h, --help ↑
Displays the usage help and exits.
-_ ↑
Prints out the variables used in the script, both public and private, for debugging.
Line Format | Info
----------- | ----
[vdef]::<var><value> | list of variables with their default value
[file]:<path>:<var><value> | list of variables set via file configuration
[strn]::<var><value> | list of variables set via config string
[args]::<var><value> | list of variables set via script arguments
- Docs
- Howtos
- Technical Info
- Other