Commit Graph

175 Commits

Author SHA1 Message Date
Jarryd Beck
464a8eb65d Add required options helper
Fixes #44. Adds a helper function for checking required options.
2017-05-31 18:10:46 +10:00
Jarryd Beck
f3582c4864 missing file 2017-05-31 17:57:27 +10:00
Jarryd Beck
9d16b98edd Support only short option
Fixes #47. Adds support for options that only have a short option.
2017-05-31 17:40:14 +10:00
Jarryd Beck
77b1b43a7c remove redundant namespace block 2017-05-31 17:25:46 +10:00
Jarryd Beck
3fa0f6caa0 some cleanup
cleanup some code smells
2017-05-31 07:35:35 +10:00
Jarryd Beck
9db62cb338 Fix broken implicit_value when given empty
Fixes #46. When an option had an implicit value, and an empty string was
passed on the command line, the implicit value would be used instead.
2017-05-18 18:06:52 +10:00
Jarryd Beck
cca5472def failing test 2017-05-17 07:38:30 +10:00
Jarryd Beck
848880d931 Fix arguments after -- without declared positional
Fixes #36. This fixes handling arguments passed after `--` when no
positional arguments have been declared, or when the positional
arguments have all been used up. The bug was that the extra arguments
were lost. Now they are retained in the modified argv.
2017-05-06 14:16:00 +10:00
Torben Jonas
21591dc8e8 Conditionally output all help groups on empty groups vector (#42)
* Conditionally output all help groups on empty groups vector

* Fix formatting
2017-05-02 07:40:45 +10:00
Jarryd Beck
3c3d2003ca add help for positional parameters 2017-04-26 18:16:00 +10:00
Jarryd Beck
1be5f10daf clarify wording on short/long
Fixes #37.

A long option is required, a short option is not.
2017-01-30 07:29:12 +11:00
Mario Badr
e005d07656 Use cmake interface library
Fixes #33.

This PR uses cmake's interface library feature:

  An INTERFACE library target does not directly create build output,
  though it may have properties set on it and it may be installed,
  exported and imported.

This makes it easier to include the header only library in a cmake
project. After using add_subdirectory on the cxxopts directory, one
simply needs to include cxxopts in their target_link_libraries, which
will allow the user's target to inherit the properties of the cxxopts
header library (see changes to example and test).
2016-12-03 07:50:14 +11:00
Jarryd Beck
f6bd09df63 change to ldflags 2016-12-02 18:05:58 +11:00
Jarryd Beck
78f3901d8d add pkg-config cflags 2016-12-02 07:56:41 +11:00
Jarryd Beck
68fba8aeca try build again 2016-12-01 18:45:29 +11:00
Jarryd Beck
85c74eb923 add pkg_config_path for osx 2016-12-01 18:25:46 +11:00
Jarryd Beck
78d99b981c install icu on osx 2016-12-01 08:03:27 +11:00
Jarryd Beck
2b8788f336 fix build 2016-11-30 20:52:57 +11:00
Jarryd Beck
423131a4f0 do all builds with unicode 2016-11-30 18:15:14 +11:00
Jarryd Beck
b4f2b0e267 build with unicode 2016-11-30 18:12:03 +11:00
Jarryd Beck
a04284fc2c fix Unicode build 2016-11-30 18:05:34 +11:00
Jarryd Beck
d92988c6a2 Allow for numbers in options
Closes #32. This adds numbers as allowed values in all parts
of short and long option specifiers.
2016-11-16 18:03:35 +11:00
Jarryd Beck
db674a467f test for hiding options 2016-10-27 07:54:42 +11:00
Jarryd Beck
c45bcc3858 Hide positional parameters that are a container.
Closes #26. Don't show positional parameters that are a container,
because they are designed for chewing up any extra parameters.
2016-08-29 18:37:15 +10:00
Jarryd Beck
9e3f3115d2 Don't overwrite positional arguments.
Fixes #30. The positional arguments are not overwritten when they
have already been given on the command line.
2016-08-29 18:11:18 +10:00
Jarryd Beck
b0078c6540 don't need env 2016-08-28 13:10:12 +10:00
Jarryd Beck
c0750d0cde try osx again 2016-08-28 13:05:55 +10:00
Jarryd Beck
bef3e67cb8 Fix uninitialised m_next_positional
This fixes the runtime error in Travis Job 17.2.

The variable Options::m_next_positional was not initialised when no
positional parameters were set.
2016-08-26 20:13:49 +10:00
Jarryd Beck
7b26c50e59 add test with no options 2016-08-26 19:20:55 +10:00
Jarryd Beck
728da0e65a add some more tests 2016-08-26 19:09:40 +10:00
Jarryd Beck
2f86fb1de0 fix test 2016-08-26 18:58:28 +10:00
Jarryd Beck
b091ec31a1 remove osx, fix clang source/package 2016-08-26 18:36:24 +10:00
Jarryd Beck
5d29ed878a try building with libc++ 2016-08-26 18:26:34 +10:00
Jarryd Beck
53ebd933ad set the language correctly 2016-08-26 08:44:46 +10:00
Jarryd Beck
0c0e0391d9 fold string 2016-08-26 08:36:58 +10:00
Jarryd Beck
e1a071480c improve build 2016-08-26 08:34:25 +10:00
Jarryd Beck
5ac2dcc5f5 output on failure 2016-08-26 08:31:53 +10:00
Jarryd Beck
7f4dd15743 use the right compiler 2016-08-26 08:29:53 +10:00
Jarryd Beck
c6554ddc49 ignore built files 2016-08-26 08:26:42 +10:00
Jarryd Beck
37e09fb92c build tests in travis 2016-08-26 08:26:13 +10:00
Jarryd Beck
defb7c8d77 try osx build 2016-08-26 08:24:55 +10:00
Jarryd Beck
55bfe49aa0 options test 2016-08-26 08:22:04 +10:00
Jarryd Beck
003ba3253e we actually wanted to use trusty 2016-08-25 18:58:30 +10:00
Jarryd Beck
f413718c5f use precise on travis 2016-08-25 18:40:40 +10:00
Jarryd Beck
09d8d0b3c5 add build status to README 2016-08-25 18:36:32 +10:00
Jarryd Beck
ca9d4e4825 update cmake version 2016-08-25 18:35:22 +10:00
Jarryd Beck
435bc38eff add gitignore 2016-08-25 18:29:00 +10:00
Jarryd Beck
2d480c0228 add testing 2016-08-25 08:49:56 +10:00
Jarryd Beck
c51b8bbdee default and implicit options in readme
This closes issue #20.
2016-08-25 08:35:01 +10:00
Jarryd Beck
abab8ce325 I27 vector<string> doesn't parse
Reorder the `parse_value` functions so that the vector-specific
function can see all of the other specific parsers.
2016-07-05 08:29:20 +10:00