Update --help. Clarify semantics in the README.
This commit is contained in:
parent
32a1de7ff7
commit
fe9652d8a5
2 changed files with 31 additions and 26 deletions
|
|
@ -75,9 +75,11 @@ General File Format
|
||||||
bash arrays.
|
bash arrays.
|
||||||
* Whitespace is ignored before and after the section name.
|
* Whitespace is ignored before and after the section name.
|
||||||
* Section names should not be quoted in any way.
|
* Section names should not be quoted in any way.
|
||||||
* Sections can be duplicated in different parts of the INI file - their keys
|
* Unless an option is used sections cannot be duplicated in different parts of
|
||||||
and values will be merged as long as the keys are unique. If the keys are
|
the INI file - the properties are ignored. With the option
|
||||||
not unique they may overwrite or append values (depending upon CLI options).
|
`--repeat-sections` the keys and values will be merged as long as the keys are
|
||||||
|
unique. If the keys are not unique, they may overwrite or append values
|
||||||
|
(depending upon CLI options).
|
||||||
|
|
||||||
Keys
|
Keys
|
||||||
----
|
----
|
||||||
|
|
|
||||||
49
parse_ini
49
parse_ini
|
|
@ -151,19 +151,19 @@ parser_help() {
|
||||||
-b <char>, --bound <char>
|
-b <char>, --bound <char>
|
||||||
The bound character which delimits the key from the value in a property
|
The bound character which delimits the key from the value in a property
|
||||||
line of the INI file. The default is "=". This must be a single
|
line of the INI file. The default is "=". This must be a single
|
||||||
character and cannot be empty value.
|
character and cannot be an empty value.
|
||||||
-c, --check
|
-c, --check
|
||||||
Check (validate) the INI file by running it through the parser. Testing
|
Check (validate) the INI file by running it through the parser. Testing
|
||||||
the INI file will report any problems or syntax errors detected in the
|
the INI file will report any problems or syntax errors detected in the
|
||||||
file to stderr, but will not output the array definitions.
|
file to stderr, but will not output the array declarations.
|
||||||
-d <char(s)>, --delim <char(s)>
|
-d <char(s)>, --delim <char(s)>
|
||||||
The character(s) (which may be an empty value) to use as a delimiter
|
The character(s) (which may be an empty value) to use as a delimiter
|
||||||
between the prefix and section name when defining the arrays. The
|
between the prefix and section name when declaring the arrays. The
|
||||||
default is "_", except where prefix is set to an empty value, in which
|
default is "_", except when '--prefix' is set to an empty value, in which
|
||||||
case the default is also empty. Only alphanumerics and _ may be used with
|
case the default is also empty. Only alphanumerics and _ may be used with
|
||||||
this option, and it may not begin with a number if prefix is empty. The
|
this option, and it may not begin with a number if '--prefix' is empty.
|
||||||
delimiter may be converted to upper or lower case depending upon the use
|
The delimiter may be converted to upper or lower case depending upon the
|
||||||
of '--uppercase' or '--lowercase'.
|
use of '--uppercase' or '--lowercase'.
|
||||||
-e, --export
|
-e, --export
|
||||||
When declaring the arrays, export them to the environment.
|
When declaring the arrays, export them to the environment.
|
||||||
-h, -?, --help
|
-h, -?, --help
|
||||||
|
|
@ -172,15 +172,16 @@ parser_help() {
|
||||||
Declare the arrays as being local in scope, instead of the default of
|
Declare the arrays as being local in scope, instead of the default of
|
||||||
global scope.
|
global scope.
|
||||||
-p <prefix>, --prefix <prefix>
|
-p <prefix>, --prefix <prefix>
|
||||||
The prefix of all the variables set when defining the arrays. The default
|
The prefix of all the variables set when declaring the arrays. The
|
||||||
is "INI". An empty prefix (denoted by "") implies '-d ""', but this can
|
default is "INI". An empty prefix (denoted by "") implies '-d ""', but
|
||||||
be overridden by explicitly specifying a delimiter with '-d'. Only
|
this can be overridden by explicitly specifying a delimiter with '-d'.
|
||||||
alphanumerics and _ may be used with this option, and it may not be empty
|
Only alphanumerics and "_" may be used with this option, and it may not be
|
||||||
when delim ('-d') begins with a number.
|
empty when delim ('-d') begins with a number.
|
||||||
-v, --version
|
-v, --version
|
||||||
Show version and copyright information.
|
Show version and copyright information.
|
||||||
|
|
||||||
Lesser used options:
|
Lesser used options:
|
||||||
|
#........1.........2.........3.........4.........5.........6.........7.........8
|
||||||
--duplicates-merge
|
--duplicates-merge
|
||||||
If a duplicate key for a specific section is found, the normal behaviour
|
If a duplicate key for a specific section is found, the normal behaviour
|
||||||
is to have the latter instance of the key overwrite the value of the
|
is to have the latter instance of the key overwrite the value of the
|
||||||
|
|
@ -189,14 +190,15 @@ parser_help() {
|
||||||
characters. Booleans are the exception to this behaviour, as the
|
characters. Booleans are the exception to this behaviour, as the
|
||||||
latter bool will always override an earlier setting.
|
latter bool will always override an earlier setting.
|
||||||
--global-name <name>
|
--global-name <name>
|
||||||
The name of the 'global' section used when defining the arrays. Only
|
The name of the 'global' section used when declaring the arrays. Only
|
||||||
alphanumerics and _ may be used with this option, which cannot be empty.
|
alphanumerics and "_" may be used with this option, which cannot be empty.
|
||||||
The name may not begin with a number, and may be converted to upper or
|
The name may not begin with a number, and may be converted to upper or
|
||||||
lower case depending upon the use of '--uppercase' or '--lowercase'.
|
lower case depending upon the use of '--uppercase' or '--lowercase'.
|
||||||
--lowercase
|
--lowercase
|
||||||
When defining the arrays, the case of the prefix ('-p') name, delimiter
|
When declaring the arrays, the case of the prefix ('--prefix') name,
|
||||||
and section name is kept as set. With this option all items are converted
|
delimiter and section name is kept as per the INI file. With this option
|
||||||
to lower case. The case of the propertie's keys/values is not affected.
|
all items are converted to lower case. The case of the propertie's
|
||||||
|
keys/values is not affected.
|
||||||
--no-booleans
|
--no-booleans
|
||||||
Normally, the parser interprites the presence of a key without an
|
Normally, the parser interprites the presence of a key without an
|
||||||
associated value as a boolean. Keys which are proceeded by "no_" are
|
associated value as a boolean. Keys which are proceeded by "no_" are
|
||||||
|
|
@ -205,21 +207,22 @@ parser_help() {
|
||||||
considered a syntax error in the INI file.
|
considered a syntax error in the INI file.
|
||||||
--no-squash
|
--no-squash
|
||||||
Do not squash multiple consecutive blanks (which are later translated to
|
Do not squash multiple consecutive blanks (which are later translated to
|
||||||
a _) into a single space while reading section names and properties.
|
a "_") into a single space while reading section names and properties.
|
||||||
--repeat-sections
|
--repeat-sections
|
||||||
Usually, if a section is repeated in the INI file its properties are
|
Usually, if a section is repeated in the INI file, its properties are
|
||||||
ignored. Using this option allows sections to be repeated in the file,
|
ignored. Using this option allows sections to be repeated in the file,
|
||||||
but this does not affect the processing of the keys/values. Ssee the
|
but this does not affect the processing of the keys/values. Ssee the
|
||||||
'--duplicates-merge' option also.
|
'--duplicates-merge' option also.
|
||||||
--textual-booleans
|
--textual-booleans
|
||||||
When defining the arrays, boolean keys are given a value of "0" or "1"
|
When declaring the arrays, boolean keys are given a value of "0" or "1"
|
||||||
(representing 'false' and 'true' respectivly). With this option the value
|
(representing 'false' and 'true' respectivly). With this option the value
|
||||||
of the key will be the text "false" or "true" instead. Ignored when
|
of the key will be the text "false" or "true" instead. Ignored when
|
||||||
'--no-booleans' is in use.
|
'--no-booleans' is in use.
|
||||||
--uppercase
|
--uppercase
|
||||||
When defining the arrays, the case of the prefix ('-p') name, delimiter
|
When declaring the arrays, the case of the prefix ('--prefix') name,
|
||||||
and section name is kept as set. With this option all items are converted
|
delimiter and section name is kept as per the INI file. With this option
|
||||||
to upper case. The case of the propertie's keys/values is not affected.
|
all items are converted to upper case. The case of the propertie's
|
||||||
|
keys/values is not affected.
|
||||||
Option processing ceases with the first non-option argument, or "--".
|
Option processing ceases with the first non-option argument, or "--".
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue