| Qore Programming Language Reference Manual 2.2.0

Loading...
Searching...
No Matches
qore Executable Command-Line Processing

This section describes command-line processing for the `qore` binary; see Qore::GetOpt for the class allowing for command-line processing in Qore code

Qore will scan the command-line for the options in the following table. Arguments after the script name will be passed to the script in the global `ARGV` variable as a list of options. `ARGV[0]` will be the first option and will not be the script name. If no script name is given and the `–exec` option is not used, then Qore code is read from standard input. The `QORE_ARGV` variable will have the original Qore command-line in it, however

Usage: `qore [`options`] [`script_file_name`]`

Parse Option Command-Line Parameters

Long Param | Short | Description
`–define=`arg | `-D` | Creates and optionally sets a value for a parse define
`–load=`arg | `-l` | Loads a module immediately. The argument can be a module/feature name or an absolute path to the module
`–no-global-vars` | `-G` | Disallows the use of global variables. Equivalent to parse option Qore::PO_NO_GLOBAL_VARS and the %no-global-vars directive
`–no-subroutine-defs` | `-S` | Disallows subroutine (function) definitions. Equivalent to parse option Qore::PO_NO_SUBROUTINE_DEFS and the %no-subroutine-defs directive
`–no-thread-control` | `-R` | Disallows any thread control operations (background operator and thread_exit statement, for example). Equivalent to parse option Qore::PO_NO_THREAD_CONTROL and the %no-thread-control directive
`–no-thread-classes` | n/a | Disallows access to thread classes (for example, the Mutex class, Gate class, Queue class, etc). Equivalent to parse option Qore::PO_NO_THREAD_CLASSES and the %no-thread-classes directive
`–no-threads` | `-T` | Disallows access to both thread control and thread classes (equivalent to the `–no-thread-control` and `–no-thread-classes` options documented above). Equivalent to parse option Qore::PO_NO_THREADS and the %no-threads directive
`–no-top-level` | `-L` | Disallows top level code. Equivalent to parse option Qore::PO_NO_TOP_LEVEL_STATEMENTS and the %no-top-level directive
`–no-class-defs` | n/a | Disallows class definitions. Equivalent to Qore::PO_NO_CLASS_DEFS and the %no-class-defs directive
`–no-namespace-defs` | n/a | Disallows new namespace definitions. Equivalent to Qore::PO_NO_NAMESPACE_DEFS and the %no-namespace-defs directive
`–no-external-process` | `-E` | Disallows any access to external processes (with system(), backquote(), exec(), the backquote operator, etc). Equivalent to parse option Qore::PO_NO_EXTERNAL_PROCESS and the %no-external-process directive
`–no-process-control` | `-P` | Disallows access to functions that would affect the current process (exit(), fork(), etc). Equivalent to parse option Qore::PO_NO_PROCESS_CONTROL and the %no-process-control directive
`–no-filesystem` | `-F` | Disallows access to the local filesystem; puts the %no-filesystem parse option in effect. Equivalent to parse option code Qore::PO_NO_FILESYSTEM and the %no-filesystem parse directive
`–no-constant-defs` | n/a | Disallows constant definitions. Equivalent to parse option Qore::PO_NO_CONSTANT_DEFS and the %no-constant-defs directive
`–no-network` | `-Y` | Disallows access to the network; puts the %no-network parse option in effect. Equivalent to parse option code Qore::PO_NO_NETWORK and the %no-network parse directive
`–no-new` | `-N` | Disallows use of the new operator. Equivalent to parse option Qore::PO_NO_NEW and the %no-new directive
`–no-database` | `-D` | Disallows use of database functionality. Equivalent to parse option Qore::PO_NO_DATABASE and the %no-database directive
`–no-child-restrictions` | `-I` | Allows child program objects to have parse option restrictions that are not a strict subset of the parents. Equivalent to parse option Qore::PO_NO_CHILD_PO_RESTRICTIONS and the %no-child-restrictions directive
`–require-our` | `-O` | Requires global variables to be declared with our prior to use (similar to perl's `use strict vars` pragma). Equivalent to parse option Qore::PO_REQUIRE_OUR and the %require-our directive
`–lock-options` | `-K` | Prohibits further changes to parse options (equivalent to the %lock-options directive)
`–lock-warnings` | `-A` | Prohibits further changes to the warning mask. Equivalent to parse option Qore::PO_LOCK_WARNINGS and the %lock-warnings directive
`–enable-all-warnings` | `-W` | Enables all warnings. Equivalent to the %enable-all-warnings directive
`–enable-warning=`arg | `-w` | Enables the named warning. Equivalent to the %enable-warning directive
`–list-warnings` | `-i` | Lists all valid warnings in Qore and exits immediately

Miscellaneous Command-Line Parameters

Long Param | Short | Description
`–disable-gc` | `-g` | Disables the garbage collector
`–exec=`arg | `-e` | parses and executes the argument text as a Qore program. If this option is specified then any script given on the command-line will be ignored
`–exec-class[=`arg`]` | `-x` | instantiates the class with the same name as the program (with the directory path and extension stripped); also turns on –no-top-level. If the program is read from `stdin` or from the command line, an argument must be given specifying the class name
`–show-module-errors` | `-m` | Shows any errors loading Qore modules
`–charset=`arg | `-c` | Sets the default character encoding for the program
`–show-charset=`arg | `-s` | Shows a list of all known character encodings
`–show-aliases` | `-a` | Shows a list of all known character encoding aliases
`–help` | `-h` | Shows help text
`–version` | `-v` | Shows Qore library version information and exits

There are two additional options available with debugging versions of Qore as follows:

Description of Debugging Command-Line Parameters

Long Param | Short | Description
`–debug=`arg | `-d` | Turns on Qore debugging output (output to `stderr`). Higher arg numbers give more output. This option is only available with DEBUG builds
`–trace` | `-t` | Turns on Qore tracing (output to `stderr`). This option is only available with DEBUG builds