Commit Graph

180 Commits

Author SHA1 Message Date
Nitin Kumar 90a32f5af1 fix: Fix usage of decrement for Iterator 2026-04-16 17:38:19 +05:30
Nitin Kumar d29fcebc56 fix: Fix shadow declaration of end 2026-04-16 17:21:18 +05:30
Nitin Kumar edbfbad35b feat: New wrapping algorithm, tests, and using wrapping on help text above options list 2026-04-16 17:19:41 +05:30
Nitin Kumar 11f26227ef
fix: Update positional api (#493)
* fix: Overwrite m_positional_set in parse_positional()

* feat: Allow append in positionals and fix discrepancy between m_positional and m_positional_set during replace
2026-03-18 17:33:51 +11:00
Nitin Kumar 25f319275e
feat: Allow implicit values with disabled arguments (#492)
* feat: Allow implicit values with disabled arguments
2026-03-03 18:21:57 +11:00
Nitin Kumar 370de72bfe
feat: allow arbitrary char in opt name (#491)
* feat: Allow arbitrary characters
2026-02-23 18:14:43 +11:00
Nitin Kumar a0f13a1528
fix: Fix short options parsing with equal sign (#488)
* feat: Add test for short options parsing

* fix: Update option parsing to allow = with short options

* fix: Fix custom option parsing in case of CXXOPTS_NO_REGEX
2026-02-02 17:37:12 +11:00
Nitin Kumar b39f57f6bc
fix: Add ci test for options_no_regex, and fix inconsistency between regex pattern and customer parser (#487)
* chore(ci): Add test for options_no_regex

* fix: Fix regex parsing for CXXOPTS_NO_REGEX
2026-01-29 18:02:15 +11:00
Nitin Kumar 89985f820e
feat: Switch to stable_partition to ensure that only first long options is printed in help (#481)
* feat: Add test for Ordering of multiple long options

* fix: Use stable_partition for deterministic ordering
2026-01-14 06:57:04 +11:00
HanaKami 8df9a4d271
Fixes potential segmentation fault in edge cases. (#465)
The options are parsed starting from 1, so check `current < argc`
instead of `!=` in the case that `argc` is zero.
2025-09-19 07:28:21 +10:00
fiesh 80cb4520f7
Fix some warnings (#452)
* Move `result` up and return it

This allows `gcc` to elide the copy in the return and keeps it from
warning with `-Wnvro` enabled.

* Remove harmful dtor definition

The definition of the dtor is not necessary and actually harmful since
the definition of a class's implicit copy constructor is deprecated if
that class has a user-declared constructor as of C++11.  Compilers can
warn about this with `-Wdeprecated`.

---------

Co-authored-by: Christoph Weiss <weiss@wsoptics.de>
2025-08-07 07:59:52 +10:00
Victor Proon 5e6d1e29f7
fix the issue with default empty vectors behaviour. update unit test (#460) 2025-07-18 07:09:03 +10:00
Jarryd Beck 44380e5a44 Fix and bump to next version 2025-05-26 18:09:26 +10:00
Nigel Stewart 7795b6a47b
C++17 std::filesystem::path support added (#447) 2025-01-14 17:56:41 +11:00
levonwaveye 10a7a64779
Add ParseResult::contains method (#440) 2024-10-24 07:14:32 +11:00
pastalian 63d1b65a69
Add missing header for gcc-15 (#438) 2024-08-28 21:31:42 +10:00
nyako c39022e047
fix conflict with minwindef.h on windows (#426) 2024-04-07 15:14:01 +10:00
Nigel Stewart 3d9a4c06d9
cxxopts as_optional fixup (#422)
Co-authored-by: Nigel Stewart <nigel.stewart@emesent.io>
2024-03-08 15:30:06 +11:00
Nigel Stewart 70fb4e4814
Extend cxxopts API to support as_optional in addition to as query of values (#421)
Co-authored-by: Nigel Stewart <nigel.stewart@emesent.io>
2024-02-29 20:27:19 +11:00
Jarryd Beck 4bf61f0869 Add changes for 3.2.1 2024-02-20 19:39:52 +11:00
jarro2783 1e175bc1db
Fix ordering of parse_value functions (#420)
Fixes #419. Put the definitions of parse_value functions before they
are called so that the right ones are chosen.
2024-02-20 19:38:44 +11:00
jarro2783 3bf268481d
Make cxxopts.hpp ready for 3.2
Update version number in header, ready for 3.2
2024-02-15 16:24:38 +11:00
ololuki e84ab5f67c
Fix overflow error in integer_parser. (#417)
Fixes #290.
Checking for overflow should be done before integer overflows.
There are two checks:
(result > limit / base) is used for limits greater than rounded up to base,
e.g. for 65535 it will activate for 65540 and higher.
(result * base > limit - digit) is used for limit+1 to limit+n below
next base rounded number, e.g. 65536 up to 65539.
2024-02-01 16:51:32 +11:00
Nigel Stewart cd61c685eb
Ordered vector of group names to preserve order of groups (#416)
Co-authored-by: Nigel Stewart <nigel.stewart@emesent.io>
2024-01-15 20:52:54 +11:00
Alexander Galanin ddc695ebac
Don't split by list delimiter in positional lists (#398) 2023-06-15 07:34:26 +10:00
Jarryd Beck 90b318105f Fix unannoted fallthrough
Fixes #402.
2023-06-15 07:18:30 +10:00
Maximilian Knespel a526762eb8
[fix] Avoid std::regex initialization during dlopen (#406) 2023-05-31 07:26:34 +10:00
Nigel Stewart 16cc254919
Output same exception messages for both Linux and Windows (#395)
Co-authored-by: Nigel Stewart <nigel.stewart@emesent.io>
2023-04-03 17:15:01 +10:00
Jarryd Beck 120205ac5a Fix cast warning in Unicode function
Fixes #339. Fixes a sign conversion warning in a function compiled by
-DCXXOPTS_USE_UNICODE_HELP=1.
2023-03-15 07:09:09 +11:00
Demian Hespe 134f60f973
Fix noexcept warning (#391) 2023-02-20 07:25:13 +11:00
Jarryd Beck eb787304d6 Fix version number 2023-02-16 07:02:16 +11:00
Martijn Courteaux 799ee0e3e8
Add <locale> to be spec-compliant for std::isalnum (didn't work on MSVC). (#385) 2023-02-11 15:47:48 +11:00
Jarryd Beck e1f8c16702 Fix diagnostics pop error 2023-02-02 07:25:12 +11:00
Jarryd Beck 4a3d4dbfe0 Fixes #362.
Fix comparing iterators from a different container.
2023-02-01 06:56:03 +11:00
Jarryd Beck 32afbc6526 Fix default bool values
Fixes #382. Keep boolean values when parsing into a reference.
2022-12-15 07:08:03 +11:00
jarro2783 e9d20c2c07
Remove deprecated iterator type (#381)
Fixes #379. `iterator` is deprecated in C++17.
2022-12-05 07:40:46 +11:00
Sourabh Mehta 1dcb44e79a
Fix an additional space in help generated (#377) 2022-11-10 07:24:19 +11:00
chrisps f087dc8fcd
Code size reduction on msvc via selectany (#373) 2022-11-01 18:52:46 +11:00
Ryan Leary 2e3c6991d3
add . as valid char in option names (#358) 2022-09-29 07:11:32 +10:00
Stefan Hillmich d046fe0ad6
Extend CI and small fixes (#370)
* Extend CI to support Windows and MacOS.
* Minor fixes to types.
2022-09-26 06:57:05 +10:00
Stefan Hillmich 82ac083886
Added missing #include (#368) 2022-09-12 07:02:26 +10:00
66maer f7cf84bd56
Fix std::isblank assertion error in Visual Studio Chinese Debug (#365) 2022-09-08 07:33:31 +10:00
Jarryd Beck ab1dc0f684 Update copyright notice
Fixes #361
2022-08-22 07:35:58 +10:00
jarro2783 a10bd5233b
Fix values attached to short options (#360)
Fixes #357.
2022-08-13 07:51:41 +10:00
Jarryd Beck 17b2c91049 Fix iostream for no exceptions
Fixes #356.
2022-08-08 07:07:59 +10:00
Jarryd Beck 96e72f7d15 Fix crash with short only option 2022-08-03 07:00:34 +10:00
Yassir Najmaoui 2abdd4af4d
Add option to display usage (#355)
Make the usage displaying optional
2022-07-28 06:50:13 +10:00
Jarryd Beck 01798ee7a0 GCC 4.8 fixes 2022-07-25 07:21:22 +10:00
Jarryd Beck a6bfe2d457 Further ifdef fixes.
Related to #339.
2022-07-20 20:57:27 +10:00
Jarryd Beck 83aecd628e Fix pragmas 2022-07-20 17:37:37 +10:00