Commit Graph

98 Commits

Author SHA1 Message Date
Jarryd Beck
8010e06952 Move parse result to an immutable object
This is far from ideal, but it's the first step in moving the parse
result to an immutable object so that the parser can be reused.
2017-10-18 18:37:58 +11:00
Hannah Rittich
2aed1ce41b Added parsing of general types. (#63)
Adds generic parsing of types using `operator>>`, in particular allows
parsing of floats and doubles.
2017-08-16 17:55:06 +10:00
Shivakar Vulli
f931fd4279 Allow spaces in option specification. (#58)
Fixes #57.

Allows spaces after the comma between the short and long option
specification.
2017-07-16 15:11:03 +10:00
Mario Werner
11faadeba7 Cmake overhaul (#53)
* remove biicode support

The company/startup died in 2015 and the open source project seems
to be dead as well.

* define compiler warning flags globally instead of locally for every binary

* add support for cmake's find_package() (refs #52)

This rewrite of the main CMakeLists.txt cleans up the way ICU flags
are attached to the library target and adds the cmake helper files
(cxxopts-config.cmake, cxxopts-config-version.cmake,
cxxopts-targets.cmake) which are needed for exporting the cxxopts
target. Cmake's find_package command uses these files when the
library is consumed by another project.

Additionally, two new tests have been added which build the example
application via add_subdirectory and find_package.

* removed target_sources from interface library

Adding target_sources to interface libraries and exporting them is
not supported in CMake 3.1 and 3.2. Furthermore, since it is a header,
it is not needed at all.

* use the *_LDFLAGS instead of *_LIBARIES when linking ICU

The LIBRARIES variable seems to contain only the name and not the
full path.
2017-06-23 18:38:42 +10:00
Jarryd Beck
3c3d2003ca add help for positional parameters 2017-04-26 18:16:00 +10: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
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
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
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
c6554ddc49 ignore built files 2016-08-26 08:26:42 +10:00
Jarryd Beck
55bfe49aa0 options test 2016-08-26 08:22:04 +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
Jarryd Beck
21489b233d fix long line 2016-07-04 19:17:54 +10:00
Pavel Medvedev
2e157e9881 Skip empty lines in option groups help
Also use single character \n for end of line instead of string literal.
2016-07-01 00:57:59 +03:00
Kevin Brightwell
774d455dc7 Update CMakeLists to be more configurable
* Add cxxopts.hpp as a source file to executable
* Add msvc options for compiling
* Add CXXOPTS_BUILD_EXAMPLES option to CMake build
  * This is helpful when using CMake's ExternalProject_add()
  * It is ON by default, but configurable from the command-line.
2016-06-15 20:32:32 -04:00
Jarryd Beck
7081d81890 add cstring for some compilers 2016-06-03 11:35:48 +10:00
Taylor Braun-Jones
7eb1bfbec1 Don't count default values 2016-05-23 15:49:52 -04:00
Nicholas Parker
ff3798f25c Remove log output
Looked like it was left over from something? Saw it when testing "--some-int-val string"
2016-04-30 09:24:04 -07:00
Jarryd Beck
81f1f440ed count arguments 2016-01-22 17:44:00 +11:00
Jarryd Beck
3ce8cbd1ae add support for -- 2016-01-22 17:43:20 +11:00
Jarryd Beck
b2e7efe7f4 positional arguments parse into multiple options 2015-09-25 16:49:06 +10:00
Kostya Bazhanov
9205d9093b Disable -Wnon-virtual-dtor warning for GCC and Clang. 2015-04-23 22:05:19 +03:00
Kostya Bazhanov
9c59bb25ff Fix Clang -Wsign-conversion and -Wshorten-64-to-32 warnings. 2015-04-18 21:50:12 +03:00
Kostya Bazhanov
2e9aab5cd0 Remove trailing spaces. 2015-04-18 21:43:37 +03:00
Baptiste Wicht
7611711651 Better support for spaces
This fixes support for options such as --file="folder with spaces/file".
2015-02-13 10:55:26 +01:00
Nagy Zsolt
44de7726f8 Fix remaining character check 2015-01-23 18:25:17 +01:00
Jarryd Beck
2144fbcc58 comment about Unicode 2014-11-08 15:30:32 +11:00
Jarryd Beck
f62ebb9688 formatting, inline 2014-10-31 08:30:50 +11:00
Baptiste Wicht
5492f17969 Add some getter
* Get list of groups
 * Get help details for groups
2014-10-30 18:14:08 +01:00
Jarryd Beck
f4c429390f Merge remote-tracking branch 'remotes/origin/master'
Conflicts:
	src/cxxopts.hpp
2014-10-30 08:56:29 +11:00
Baptiste Wicht
164095cc0c Macro to disable RTTI 2014-10-29 17:52:30 +01:00
Baptiste Wicht
4e4e91c37d Fix warnings 2014-10-29 17:35:42 +01:00
Baptiste Wicht
0639e086ea Finalize help 2014-10-29 17:04:53 +01:00
Baptiste Wicht
e09bb9052a Enhance example 2014-10-29 16:59:57 +01:00
Baptiste Wicht
9a2749f692 Merge branch 'master' into default_values
Conflicts:
	src/cxxopts.hpp
	src/example.cpp
2014-10-29 16:42:59 +01:00
Jarryd Beck
1a558d76bd custom argument help 2014-10-29 12:35:05 +11:00
Baptiste Wicht
9642317b08 Fix implicit and short 2014-10-28 21:36:33 +01:00
Baptiste Wicht
32be452302 Fix compilation 2014-10-28 21:27:29 +01:00
Baptiste Wicht
cc65ebb4fc Fix warning 2014-10-27 19:25:44 +01:00
Baptiste Wicht
65093e0432 Cleanup 2014-10-27 19:19:54 +01:00
Baptiste Wicht
387e51dc16 Merge branch 'master' into default_values
Conflicts:
	src/cxxopts.hpp
2014-10-27 19:09:41 +01:00
Jarryd Beck
8d7c4ea43e unicode configuration 2014-10-27 22:06:24 +11:00
Jarryd Beck
8234766bca better help example 2014-10-27 16:47:21 +11:00
Jarryd Beck
3707c91a01 unicode help 2014-10-27 16:46:16 +11:00
Jarryd Beck
9509ca94f2 unicode 2014-10-27 16:45:13 +11:00
Jarryd Beck
9d1a4dfcdc more icu::UnicodeString 2014-10-27 15:20:12 +11:00
Jarryd Beck
f514d7d71e start converting to String for Unicode 2014-10-27 13:30:22 +11:00
jarro2783
0cd24a7e6b Merge pull request #7 from wichtounet/space_between_groups
Add an eol between each option groups
2014-10-27 10:59:41 +11:00