Option parsing

Introduction

Restad commands accept parameters from command-line or from a config file (INI format). Each parameter has a key of one letter, and a unique name (optional). Using the command line, you must specify a parameter with its one-letter key. Using the config file, you can use both key and unique name.

Parameters can be flags, or values. A flag is actually like a boolean value, but its use is simpler. A value can be string or integer and can be empty or not. You can overwrite config-file parameters with the command-line.

Command line

To set one or more flag(s) just give as command argument the one-letter key(s) after an hyphen "-". You can group flags like this :

    $ restad-command -a -b -c
    $ restad-command -abc 

To set a value you must give the option key and then the value :

    $ restad-command -d value 

To set a string value with spaces, enclose it with double-quotes :

    $ restad-command -d "some words" 

You can group flags and one value, but only by putting the value key as the last character :

    $ restad-command -abcd value
    $ restad-command -abdc value -> Error 

Config file

The config file uses the INI format. This means "key=value" text on each line. Empty lines or comment lines (using # at the begining of the line) have no effect on the parsing. You can use both one-letter key or long-name. Flag options must have a "true" or "false" value. Like command line options, to pass string value with spaces you must enclose it with double-quotes.

# This is a comment
a=true
output=target-file
message = "I got spaces"
run = 10 
All Classes Functions Variables Typedefs Enumerations Enumerator