Added a discussion of the parser's set_group_name() method.

This commit is contained in:
Davis King 2012-12-12 21:01:05 -05:00
parent 251266dce8
commit 962ba9ae94

View File

@ -13,13 +13,16 @@
Options: Options:
-c Indicates that we want to compress a file. -c Indicates that we want to compress a file.
-d Indicates that we want to decompress a file. -d Indicates that we want to decompress a file.
-h Display this help message.
--in <arg> This option takes one argument which specifies the name of the --in <arg> This option takes one argument which specifies the name of the
file we want to compress/decompress. file we want to compress/decompress.
-l <arg> Set the compression level [1-3], 3 is max compression, default
is 2.
--out <arg> This option takes one argument which specifies the name of the --out <arg> This option takes one argument which specifies the name of the
output file. output file.
Miscellaneous Options:
-h Display this help message.
-l <arg> Set the compression level [1-3], 3 is max compression, default
is 2.
*/ */
@ -55,6 +58,12 @@ int main(int argc, char** argv)
parser.add_option("in","This option takes one argument which specifies the name of the file we want to compress/decompress.",1); parser.add_option("in","This option takes one argument which specifies the name of the file we want to compress/decompress.",1);
// add a --out option that takes 1 argument // add a --out option that takes 1 argument
parser.add_option("out","This option takes one argument which specifies the name of the output file.",1); parser.add_option("out","This option takes one argument which specifies the name of the output file.",1);
// In the code below, we use the parser.print_options() method to print all our
// options to the screen. We can tell it that we would like some options to be
// grouped together by calling set_group_name() before adding those options. In
// general, you can make as many groups as you like by calling set_group_name().
// However, here we make only one named group.
parser.set_group_name("Miscellaneous Options");
parser.add_option("h","Display this help message."); parser.add_option("h","Display this help message.");
parser.add_option("l","Set the compression level [1-3], 3 is max compression, default is 2.",1); parser.add_option("l","Set the compression level [1-3], 3 is max compression, default is 2.",1);