1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 04:03:52 +00:00

55 Commits

Author SHA1 Message Date
Philip Top
6b7f6a7480 Value initialization (#416)
* work on the flags book chapter and making sure the values are initialized properly.

* Fix initialization of values used in flags or options

* update some formatting and more brace initialization

* update more formatting and fix a incorrect initializer

* more formatting and some error fixes

* more formatting

* Small formatting fix

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2020-01-27 09:42:03 -06:00
Christoph Bachhuber
ffe5b29e1f Add cstdint and std::prefix to its symbols (#409)
* Add cstdint and std::prefix to its symbols

* Use int64_t in std::
2020-01-21 18:24:40 -06:00
Henry Schreiner
d5cd986046 Rename size_t -> std::size_t 2019-12-31 10:35:24 -05:00
Philip Top
5f696596d7 fix some warnings generated from klocwork static analyzer (#350)
* fix some warnings generated from klocwork static analyzer

* Some more visual studio static analyzer and clang-tidy fixes

* some formatting updates
2019-11-29 08:54:32 -05:00
christos
51a395ec9f Handle float type in positive number (CLIUtils#328) (#342)
* fix https://github.com/CLIUtils/CLI11/issues/328

 * use same assumptions about the size (ie double is enough) as in Number validator

* fix spelling in error message

* fix class description comment

* PositiveNumber accepts now >0 while NonNegative >=0

* update README for PositiveNumber and NonNegativeNumber

* spelling
2019-11-25 14:52:37 -05:00
Philip Top
418b7175f5 Type size refactor (#325)
* add expanded type_size specification

* add some more checks for type_size_max

* continued work on getting type sizes more flexible

* make some more tweaks to option to split up validate and reduce sections

* git rid of exceptions on the type_size functions exceptions,  allow any number to be entered for the min and max and don't make a distinction between flags and other types.

* add expected count

* add the allow extra args flag in an option

* start working in allow_extra_args

* write some stuff in the book,  and continue working on the failing test cases

* fix a few more of the helpers tests

* a few more test cases running

* all tests pass, fixing calls in ini files

* get vector<pair> working and all tests passing

* change callback to use reference to remove allocation and copy operation

* add support and test for vector<vector<X>>

* change Validators_ to validators_ for consistency

* fix linux warnings and errors by reording some templates and adding some typename keywords

* add support for std::vector<X> as the cross conversion type so optional<std::vector<X>> is supported using the full template of add_option.

* a few more test cases to take care of some coverage gaps

* add missing parenthesis

* add some more tests for coverage gaps

* add test for flag like option

* add transform test for `as<X>` function and make it pass through the defaults

* add a few more tests and have vector default string interpreted correctly.

* add test for defaulted integer,  and route default string for defaulted value which would otherwise be empty

* some code cleanup and comments and few more test coverage gap tests

* add more tests and fix a few bugs on the type size and different code paths

* remove path in results by fixing the clear of options so they go back to parsing state.

* get coverage back to 100%

* clang_tidy, and codacy fixes

* reorder the lexical_conversion definitions

* update some formatting

* update whitespace on book chapter
2019-11-10 05:36:16 +10:30
Philip Top
67c441b527 add separate condition for index into vectors
remove restrictions on tuple size, and add some additional tests and modified documentation

fix some issues with the negative number check

add some test for indexed validation on tuple

allow specific validators for specific elements in a type with multiple values, or to just apply to the last given argument
2019-09-02 20:58:26 -04:00
Philip Top
127f5388ab Support tuple (#307)
* add some tests with default capture on the two parameter template and some notes about it in the README.md

remove the test from visual studio 2015
vs2015 doesn't seem to properly deal with is_assignable in the cases we care about so make a standalone version that is more direct in what we are doing

add version to appveyor and add some notes to the readme

fix a few test cases to make sure code is covered and test a few other paths

remove unneeded enum streaming operator

add some diagnostic escapes around trait code to eliminate gcc Wnarrowing warnings

work specification of the template operations

remove optional add some templates for options conversions

add the two parameter template for add_option

* Fix some comments from Code review and add more description

* start work on trying to clean up the type traits for which lexical cast overload to use

* fix readme issue and make the condition tests a little clearer

* add a check for out of range errors on boolean conversions

* Fix capitalization and some comments on option functions

* Allow immediate_callback on the main app to run the main app callback prior to named subcommand callbacks, and reflect this change in the a new test and docs.

* add a is_tuple_like trait, and type_count structure for getting the number of elements to require

* add lexical conversion functions for tuples and other types

* remove the separate vector option and option function

* test out the type names for tuples

* add some more lexical conversion functions and test

* more work on tuples and tests

* fix some merge warnings

* fix some typename usage and c++14 only constructs

* tweak some of the template to remove undefined references

* add extra static assert about is_tuple_like

* fix some undefined references in clang

* move around some of the type_count templates to be used in the type_name functions

* move the type_count around and add some additional checks on the classification

* add some info to the readme
2019-08-16 09:58:15 -04:00
Philip Top
ba7aac9c8a remove undefined bahavior (#290)
* change the checked_multiply function to not use undefined behavior to check for potential undefined behavior and wrapping.

* update the checked_multiply template to deal with mismatched sign in signed numbers and min val correctly.  This involved adding to templates to clear up warnings
2019-07-29 00:20:37 -04:00
Philip Top
eab92ed988 modified option template (#285)
* add some tests with default capture on the two parameter template and some notes about it in the README.md

remove the test from visual studio 2015
vs2015 doesn't seem to properly deal with is_assignable in the cases we care about so make a standalone version that is more direct in what we are doing

add version to appveyor and add some notes to the readme

fix a few test cases to make sure code is covered and test a few other paths

remove unneeded enum streaming operator

add some diagnostic escapes around trait code to eliminate gcc Wnarrowing warnings

work specification of the template operations

remove optional add some templates for options conversions

add the two parameter template for add_option

* Fix some comments from Code review and add more description

* fix case when string_view doesn't work to append to a string.

* This PR also addressed #300

* modify lexical_cast to take  const std::string &, instead of by value to allow string_view in a few cases
2019-07-29 00:19:35 -04:00
Henry Schreiner
7b315782e1
Warnings (#281)
* Fixing some warnings

* Make gtest a system library

* Fixing format

* Adding better method for adding warnings

* Nicer Windows deprecated test

* JSON update and drop testing timer

* Warnings as errors everywhere
2019-05-18 19:11:27 +02:00
Viacheslav Kroilov
59a36565fe Support for size values (640 KB) and numbers with unit in general (#253)
* [WIP] Initial implementation

* Add mapping validation

* More documentation

* Add support for floats in checked_multiply and add tests

* Place SuffixedNumber declaration correctly

* Add tests

* Refactor SuffixedNumber

* Add as size value

* Update README

* SFINAE for checked_multiply()

* Mark ctors as explicit

* Small fixes

* Clang format

* Clang format

* Adding GCC 4.7 support

* Rename SuffixedNumber to AsNumberWithUnit
2019-05-18 06:22:17 +02:00
Henry Schreiner
d81843002a
To string and default option revamp (#242)
* First streaming version

* Using to_string instead

* Switching to new backend

* Moving to capture function for defaults

* Rename capture_default + _str

* defaultval -> default_str, added always_capture_default

* Fix style

* Adding tests and docs to readme

* Dropping macOS on Travis (supported through Azure)
2019-04-28 22:44:30 +02:00
ryan4729
734af661c6 fix tests on aarch64 (#266)
* fix tests on aarch64
2019-04-18 15:00:11 +02:00
Philip Top
76d2cde656 Positional argument checks (#262)
* some tweaks with optional

* remove set_results function that was bypassing some of the result processing in some cases of config files.

* add positional Validator example and tests add CLI::Number validator.

* add positional Validator example and tests add CLI::Number validator.

* do some reformatting for style checks and remove auto in test lambda.
2019-04-11 12:04:30 +02:00
Philip Top
3f9fafd916 make immediate_callback inheritable, add tests for that and for valid strings, some cleanup in the README.md
Apply suggestions from code review

Co-Authored-By: phlptp <top1@llnl.gov>
allow callbacks for option_groups, and allow some other characters as flags
2019-03-22 17:56:36 -04:00
Philip Top
ed5cd89636 remove template for operator[] and adjust some tests
add some comments in readME about performance

move operator[] to return const Option *

Apply suggestions from code review

Co-Authored-By: phlptp <top1@llnl.gov>

update readme and add some IniTests and fix a bug from the tests

add_flag_callback

add a few tests to capture the different paths

fix incorrectly updated CMAKE file, and add some subcommand test for option finding

add disable_flag_override and work out some kinks in the find option functions

add some more tests and fix a few bugs in as<> function for options

Allow general flag types and default values, add shortcut notation for retrieving values
2019-02-23 07:40:41 +01:00
Philip Top
6c645b55a1 Add better enum support in the library (#233)
* add some notes about enums in the readme

add some helpers tests for enumerations

Add better enum support in the library

* fix Helpers Test for Enums
2019-02-20 22:57:37 +01:00
Philip Top
c8bd97156b click-style boolean flags (#219)
Updates to the readme

update the readme with some documentation

add a few more tests to complete code coverage

update with count strings in flags instead an array of strings for each count

add the '!' shortcut notation.  add some checks on the help output

allow the false flag syntax to support --option{false}

add a bool lexical cast to make everything consistent when converting to a bool.  Moved a few functions around

make the command line behave like the INI file wrt flags, flag options are allowed to process the value so `--flag=false` actually does the expected thing.

Add functionality similar to click style argument that allow specifying a false flag that when used generates a false result on the flag.
2019-02-09 23:51:38 +01:00
Henry Schreiner
b4910df3d7
Move to using literals in testing (#213) 2019-02-01 11:32:47 +01:00
Rafi Wiener
d3c3a4c58f add validator for ip address and positive number 2019-02-01 00:43:26 +01:00
Henry Schreiner
f932b51374
Touchupwin (#189)
* Move lambda funtion to real function

* Fix some warnings when compiling in LLVM

* Adding one test back in

* Adding details to changelog
2019-01-11 11:58:00 +01:00
Philip Top
ce6dc0723e add options to handle windows style command line options (#187)
* add some fields and functions for windows like options
add test cases for windows options and refactor for additional string functions

* try to fix code coverage to 100% again.  add some additional documentation and a few additional test cases to verify documentation

* remove some extra brackets
2019-01-10 23:07:17 +01:00
Philip Top
30c2e327d1 Add single string parsing (#186)
* add Tests and ability to handle program file inclusion in the single string.

add the ability to deal with a single string in the parse command and handle quoted string appropriately

* Add extra test cases for full coverage, clear up escape quote sequencing and handling of extra spaces
2019-01-06 10:30:49 +01:00
Henry Fredrick Schreiner
101d847c29 Use filter fn to simplify, sort includes 2018-05-06 18:36:33 +02:00
Henry Fredrick Schreiner
2b6b62c52c Adding smart validators 2018-05-03 17:04:13 +02:00
Henry Fredrick Schreiner
bea833bbcd Adding and fixing more warnings 2018-03-26 11:48:23 +02:00
Henry Schreiner
79a1847605
Overflow (#84)
* Overflowing an integer conversion now results in a conversion failure

* CMake improvements for VERSION and inital packing support

* Fix for recent addition of overflow check

* Conan file now gets version from Version.hpp file too
2018-03-10 09:50:25 +01:00
Anton
15f9a4f128 Add check if lexical_cast fully consumed input on integer conversion (#68)
* Split signed/unsigned parsing, add check if input is fully consumed, improve tests

* Fix complex numbers parsing

* Add check if input is fully consumed for double lexical_cast, improve tests

* Add non-num non-string lexical_cast for parsable types, add tests

* Style fixes from check-style

* Some small fixes for corner case tests
2018-03-09 13:01:19 +01:00
Lucas Czech
7868dc9f6c Add path exists validator. 2018-01-07 22:35:01 +01:00
Henry Fredrick Schreiner
78ed995685 Add multiline ini comments 2017-12-23 14:17:38 -06:00
Henry Fredrick Schreiner
85857d99e1 Return string for error message in validators 2017-11-24 21:11:28 -05:00
Henry Fredrick Schreiner
c6ddbeb281 Fix for spaces in names issue 2017-09-06 05:51:12 -05:00
Henry Fredrick Schreiner
27f718125d Reformat with clang-format 2017-05-31 12:03:05 -04:00
Henry Fredrick Schreiner
101c926dac Adding tidy cleanups (modernize) 2017-05-31 07:38:22 -04:00
Henry Fredrick Schreiner
e772c0e43b Trying to fix VS warning 2017-03-30 16:43:14 -04:00
Henry Fredrick Schreiner
43b451e327 Fix a few warnings, add to Changelog 2017-03-30 16:39:20 -04:00
Henry Fredrick Schreiner
f88aa33908 Fix a few errors and warnings with tests 2017-03-30 16:36:05 -04:00
Henry Fredrick Schreiner
ee9219e0f8 Adding warnings and fixes, CLI11 target, support for VIM Syntastic 2017-03-27 13:53:57 -04:00
Henry Fredrick Schreiner
0ca8a43ebd Better ini config behavour with one quote 2017-03-15 08:29:26 -04:00
Henry Fredrick Schreiner
d857b24786 Filling out string tools 2017-03-14 18:05:31 -04:00
Henry Fredrick Schreiner
bdf3993d09 Adding test for coverage, fixed bug in uncovered code 2017-03-09 09:37:16 -05:00
Henry Fredrick Schreiner
09afb2436f Adding test for bad name string long 2017-03-09 08:42:58 -05:00
Henry Fredrick Schreiner
2af5577b39 Adding missed update 2017-03-08 09:16:19 -05:00
Henry Fredrick Schreiner
228fd36cec Adding tests for Types, lexical casts, dropped useless and incorrect template 2017-03-08 09:15:35 -05:00
Henry Fredrick Schreiner
e23f56551d Adding Validator tests, fixed a bug 2017-03-08 08:25:10 -05:00
Henry Fredrick Schreiner
37f17fc19a Adding subcommand vectors and subsections 2017-03-03 17:25:27 -05:00
Henry Fredrick Schreiner
9d697b8511 Fallback support added, better structure 2017-03-02 12:02:44 -05:00
Henry Fredrick Schreiner
7856de43ca Broken tests only because adding new desired behavior 2017-03-01 16:01:29 -05:00
Henry Fredrick Schreiner
4fca03d031 Adding case check for subcommand (simple) 2017-02-20 13:23:05 -05:00