Elektra  0.9.5
Plugin: gopts

This plugin allows applications to access command-line options and environment variables via the KDB.

It is implemented as a simple frontend for the parser implemented in the internal elektraGetOpts.

For more information on how to write the necessary specification and on using command-line options in general, take a look at the dedicated tutorial

Depending on the calling context and configuration, this plugin might use operating system specific functions to determine command-line arguments and environment variables. Which operating system's functions the plugin uses is determined at compile-time.

Note: One of the system-specific implementations of this plugin relies on procfs. Therefore, if you compile the plugin on a system with procfs, the plugin may not work on other machine with the same OS or even on the same machine, if procfs is not mounted.

The preferred way of using this plugin is via a kdbOpen contract:

KeySet * contract = ksNew (0, KS_END);
elektraGOptsContract (contract, argc, argv, environ, parentKey, NULL);
KDB * kdb = kdbOpen (contract, parentKey);
// gopts automatically mounted
KeySet * ks = ksNew (0, KS_END);
kdbGet (kdb, ks, parentKey);

The plugin accepts a number of configuration keys.

The plugin also takes part of its configuration from the global KeySet. All keys the plugin uses are below system:/elektra/gopts. This prefix is abbreviated to // below.

This plugin may use the following keys from the global KeySet: