Commit Graph

351 Commits

Author SHA1 Message Date
Matthew Limbinar
7474a66ef6
Clarify positional argument docs (#335) 2022-07-04 09:55:17 +10:00
Alexander Kiselyov
a70771ae89
Fixed cmake install path in case of empty architecture (#322) 2022-06-16 07:34:14 +10:00
Jarryd Beck
5f72b525c2 Add changelog note 2022-05-11 17:47:37 +10:00
Long Deng
c59e0c132c
Solve arguments() showing empty keys when only short-only option exists (#318)
* Solve `arguments()` showing empty keys when there is only a short option.
2022-05-11 17:44:25 +10:00
Jarryd Beck
f0f465b20f Add unmatched arguments to example
Ref #242. Adds an example in the example file showing the unmatched
arguments that are stored.
2022-05-03 06:21:12 +10:00
Jarryd Beck
8185e6bb3a Remove unused variables
Fixes #324
2022-03-26 12:19:36 +11:00
Yannic Staudt
779c429b0e
Added instructions to use cxxopts with tipi to INSTALL (#325) 2022-03-22 22:01:25 +11:00
Jarryd Beck
4e208b95b7 Add a program function
Fixes 323. Adds a function to retrieve the program name.
2022-01-14 16:26:48 +11:00
Long Deng
ad2d1a6b5f
Add iterator (#126) and easily print-out (#223) to ParseResult (#313)
* Add iterator (#126) and easily print-out (#223) to ParseResult
2021-11-09 18:49:58 +11:00
Jarryd Beck
c74846a891 Fix short options adding into unmatched
Fixes #312.
2021-10-21 08:06:53 +11:00
Jarryd Beck
a150450486 Readme change for 3.0 2021-10-21 07:50:58 +11:00
Jarryd Beck
e8b5befff8 Add changes for 3.0 release 2021-10-21 07:47:55 +11:00
Jarryd Beck
d2f0bbfed1 Add note about count with default
Fixes #311.
2021-10-21 07:37:23 +11:00
Nick Krichevsky
4a02ad94f4
Include <optional> if possible to check if we can use the feature (#309)
Fixes #303
2021-10-10 13:01:47 +11:00
Jarryd Beck
c641241a87 Fixes to #204. 2021-10-09 17:02:27 +11:00
Baojun Wang
4b7fccb5f2 Allow empty string to be valid positional arguments
Fixes #204.
2021-10-09 17:02:27 +11:00
jarro2783
1ff0da6401
Add more compilers (#307) 2021-10-09 15:52:52 +11:00
jarro2783
54489e4276
Add the two available OS (#306) 2021-10-09 12:48:44 +11:00
jarro2783
4fcadd83a7
Try workflow template 2021-10-09 12:18:17 +11:00
Jarryd Beck
7d99716319 Add workflow dispatch 2021-10-09 12:13:11 +11:00
Jarryd Beck
946ebb6f83 Initial build action 2021-10-09 12:03:20 +11:00
Jarryd Beck
d3aa51d555 Add dummy workflow 2021-10-09 12:00:13 +11:00
KOLANICH
5eca8a3001
Added CPack packaging, pkg-config and CMake version files. (#298) 2021-07-31 10:34:21 +10:00
Jarryd Beck
df229cff0d Fix integer parsing to be more general
Fixes #277. Makes integer parsing to be more general and allow whatever
types the user actually uses instead of hard coding a set of integers.
2021-06-02 17:30:08 +10:00
Jarryd Beck
a20bda6179 Fix GCC version check for null deref
Fixes #288.
2021-06-01 17:38:41 +10:00
RonxBulld
97a4d5511f
Support options like -j5. (#286)
* Support option value being attached after the option without a space in between. e.g. -j5
2021-05-06 08:46:40 +10:00
spmn
056a6281ac
Fix empty option name in OptionException (#256)
Fix bug where option name is missing in error.
2021-05-06 08:45:15 +10:00
RonxBulld
c04f8a5bb9
Fully compatible with GCC4.8 compilation system. (#285)
* -Wsuggest-override is not supported by gcc before 5.0
* GCC prior to 5.0 should ignore not only -Wnon-virtual-dtor but also -Weffc++, otherwise non-virtual destructor problems will still be reported.
* The `#pragma GCC diagnostic push' should be used before setting up the temporary environment.
* When using GCC4.8, use manual lexical analysis instead of regular expressions.
* Add gcc4.8 stuff to travis file.
2021-05-04 17:35:45 +10:00
RonxBulld
174510285a
-Wsuggest-override is not supported by gcc before 5.0 (#283)
* -Wsuggest-override is not supported by gcc before 5.0

* GCC prior to 5.0 should ignore not only -Wnon-virtual-dtor but also -Weffc++, otherwise non-virtual destructor problems will still be reported.

* The `#pragma GCC diagnostic push' should be used before setting up the temporary environment.
2021-04-21 18:17:30 +10:00
jarro2783
dd45a0801c
Rename BUILD to BUILD.bazel 2021-02-20 15:12:07 +11:00
Jarryd Beck
aaa5e790b6 Rename variable, add to example 2021-02-15 08:34:46 +11:00
Wolfgang Gahr
43ce03fdbd
Improve formatting of help descriptions (#215)
* Improve formatting of help descriptions (#213)

* new function: cxxopts::Option::set_width(size_t width)
  Set the size of a helpline.
* new function: cxxopts::Option::set_tab_expansion()
  Expand the tabs in descriptions.
  The tabsize 8 chars, base is start of description.
  The descriptions are not disturbed by adding additional options.
* Allow newlines \n and tabs \t in descriptions.

Other changes (last commit/new commit):
* 1453/1471: size_t for OPTION_LONGEST and OPTION_DESC_GAP.
  This prevents the static cast in 2086/2140.
* 2088/2142: in case of small width the value of
  "width - longest - OPTION_DEC_GAP" becomes negative.
  Because size_t is unsigned the result is a big number, and
  the width of the column of the descriptions is not shortened.
* new 2143: When the given width is too small, it is set to
  longest + OPTION_DESC_GAP + 10
* new 1570: A long description is broken into multiple lines, and
  the iterator lastSpace remembers the begin of the last word.
  But when the iterator current reaches the end of line, the whole
  string from iterator is printed, which in soome cases is too
  long. Thats why one blank is added to the description to trigger
  the handling of lastSpace.
  Accordingly in 1574/1627 the line is shortened by one char.

* repaired signed/unsigned issue

* changes for unicode
2021-02-12 08:17:55 +11:00
Jarryd Beck
f34d603863 Fix missing override 2021-02-08 09:44:26 +11:00
Jarryd Beck
d10a9b5678 Upgrade GCC versions 2021-02-08 08:41:20 +11:00
Jarryd Beck
e862445ef3 Fix null dereference warning error
Fixes #276. Remove the fix for null dereference warning for GCC after
10.1.0 because this was removed in later versions.
2021-01-23 14:08:56 +11:00
Rosen Penev
ed85f04a1b
clang-tidy stuff (#266)
Several clang-tidy improvements.
2021-01-19 17:05:09 +11:00
Benjamin Sergeant
834fb9999b
Ignore gcc-10 warning (#273)
Workaround for GCC 10 null dereference warning.
2021-01-19 17:00:45 +11:00
jpr89
dc9a7728c0
Fixing cmake developer warning (#274)
Here is the warning currently being produced:

CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/GNUInstallDirs.cmake:223 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):

I noted how I fixed the error. This is caused by GNUInstallDirs automatically executing code just by including it.

I also added -Werror=dev to the CI to ensure this never happens again.

Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-19 16:55:23 +11:00
jpr89
c55726ee29
Cmake Revamp (#270)
* Cmake Revamp

I needed to do a variety of things to ensure cxxopts worked well in my own project.

I created a new cmake module to abstract a lot of the logic in the main CMakelists.txt, I think it really assists in the readability of the project. Consequently a lot of logic is now written in functions.

I made a lot of the project options off by default unless the project is being built standalone. As a frequent consumer of cmake libraries this is a huge issue. Since examples, tests, installation, etc. aren't things I expect/desired by default when using libraries.

Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-17 12:11:02 +11:00
Dan Ibanez
2d8e17c4f8
Add CMake option to not add warning flags (#267)
Allow extra compiler warnings to be disabled.
2020-12-15 08:47:52 +11:00
fiesh
66b52e6cc9
Add -Wsuggest-override (#264)
We also add the suggested `override` keyword.
2020-10-21 10:24:41 +11:00
Daniel Lemire
12e496da3d
Making sure that the library can compile without warnings even when crazy pedantic flags are set (#238)
Makes some fixes to satisfy various strict warnings.
2020-10-06 17:06:33 +11:00
jarro2783
3ef9fddc7b
Fix passing a const array to parse (#258)
Fixes #257. The input array is not modified, so we can declare this as
`char const* const*`.
2020-10-03 20:54:06 +10:00
Jarryd Beck
4b63c333a8 Improve README note 2020-10-01 20:09:16 +10:00
Jarryd Beck
748ac35277 small cleanup 2020-10-01 17:26:32 +10:00
Jarryd Beck
703eeef906 Update version for 3 2020-10-01 17:14:39 +10:00
Jarryd Beck
31b77f11af Prepare notes for v3 2020-10-01 17:14:39 +10:00
Jarryd Beck
fedf9d7b57 Refactor parser
Major refactor of the parsing code organisation to improve encapsulation
and not modify the input arguments. The returned result no longer has
pointers into the original option specification.
2020-10-01 17:12:03 +10:00
Daniel Gomez Antonio
fd5cdfd547
Fix compiler warning C4702 for MSVC-14 (#225)
* Fix compiler warning C4702  for MSVC-14
2020-09-15 10:07:53 +10:00
Vitaly Zaitsev
584e0c3dd3
Fixed installation on other than Ubuntu GNU/Linux distributions. (#226)
Fixes the installation paths by using cmake variables.
2020-08-19 09:16:11 +10:00