diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2016-05-09 19:14:16 -0400 |
---|---|---|
committer | Taylor C. Richberger <taywee@gmx.com> | 2016-05-09 19:14:16 -0400 |
commit | dd1ed9fe73a0c45f2612e32627e0d4b6bcba8690 (patch) | |
tree | 8ed28eb5db2cba62dab55ba3c4de7995b6a07ce4 /README.md | |
parent | some small const improvements (diff) | |
parent | make changes, bump version number (diff) | |
download | args.hxx-dd1ed9fe73a0c45f2612e32627e0d4b6bcba8690.tar.xz |
Merge branch '12-allow-user-to-specify-argument-separation-on-argumentparser' into 'master'
2.1.0
12 allow user to specify argument separation on argumentparser
Closes #12
See merge request !8
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 39 |
1 files changed, 23 insertions, 16 deletions
@@ -1,7 +1,7 @@ # args A simple, small, flexible, single-header C++11 argument parsing library, in -about 1.3K lines of code. +about 1K lines of code. This is designed to somewhat replicate the behavior of Python's argparse, but in C++, with static type checking, and hopefully a lot faster. @@ -42,16 +42,14 @@ It: * Lets you parse, by default, any type that has a stream extractor operator for it. If this doesn't work for your uses, you can supply a function and parse the string yourself if you like. +* Lets you decide not to allow separate-argument argument flags or joined ones + (like disallowing `--foo bar`, requiring `--foo=bar`, or the inverse, or the + same for short options). # What does it not do? There are tons of things this library does not do! -## It does not yet: - -* Let you decide not to allow separate-argument argument flags or joined ones - (like disallowing `--foo bar`, requiring `--foo=bar`, or the inverse, or the - same for short options). ## It will not ever: @@ -65,6 +63,12 @@ There are tons of things this library does not do! `--foo` in the same parser), though shortopt and longopt prefixes can be different. * Allow you to have argument flags only optionally accept arguments +* Allow you to make flag arguments sensitive to order (like gnu find), or make + them sensitive to relative ordering with positional flags. The only + orderings that are order-sensitive are: + * Positional options relative to one-another + * List positional options or flag arguments to each of their own respective + items * Allow you to use a positional argument list before any other positional arguments (the last argument list will slurp all subsequent positional arguments). The logic for allowing this would be a lot more code than I'd @@ -112,16 +116,19 @@ can be pulled from their value and values attributes, if applicable. # How fast is it? This should not really be a question you ask when you are looking for an -argument-parsing library, but I did run a simple benchmark against args, TCLAP, -and boost::program_options, which parses the command line `-i 7 -c a 2.7 --char -b 8.4 -c c 8.8 --char d` with a parser that parses -i as an int, -c as a list -of chars, and the positional parameters as a list of doubles (the command line -was originally much more complex, but TCLAP's limitations made me trim it down -so I could use a common command line across all libraries. I also have to copy -in the arguments list with every run, because TCLAP permutes its argument list -as it runs (and comparison would have been unfair without comparing all about -equally), but that surprisingly didn't affect much. Also tested is pulling the -arguments out, but that was fast compared to parsing, as would be expected. +argument-parsing library, but every test I've done shows args as being about +65% faster than TCLAP and 220% faster than boost::program_options. + +The simplest benchmark I threw together is the following one, which parses the +command line `-i 7 -c a 2.7 --char b 8.4 -c c 8.8 --char d` with a parser that +parses -i as an int, -c as a list of chars, and the positional parameters as a +list of doubles (the command line was originally much more complex, but TCLAP's +limitations made me trim it down so I could use a common command line across +all libraries. I also have to copy in the arguments list with every run, +because TCLAP permutes its argument list as it runs (and comparison would have +been unfair without comparing all about equally), but that surprisingly didn't +affect much. Also tested is pulling the arguments out, but that was fast +compared to parsing, as would be expected. ### The run: |