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

46 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
Philip Top
c67ab9dd43 Config file handling refactor. (#362)
Refactor some of the configuration file handling code.  Make it easier to get the actual file that was processed, and allow extras in the config file to be ignored (default now), captured or errored.

fix std::error reference and formatting

add test for required but no default and fix a shadow warning on 'required' from gcc 4.8

Test correctness of config write-read loop

fix config generation for flag definitions

make the config output conform with toml

continue work on the config file interpretation and construction

get all the ini tests working again with the cleaned up features.

update formatting

rename IniTest to ConfigFileTest to better reflect actual tests and add a few more test of the configTOML
disambiguate enable/disable by default to an enumeration, and to make room for a configurable option to allow subcommands to be triggered by a config file.
add a ConfigBase class to generally reflect a broader class of configuration files formats of similar nature to INI files

add configurable to app and allow it to trigger subcommands

add test of ini formatting

add section support to the config files so sections can be opened and closed and the callbacks triggered as appropriate.

add handling of option groups to the config file output

add subcommand and option group configuration to config file output

subsubcom test on config files

fix a few sign comparison warnings and formatting

start working on the book edits for configuration and a few more tests

more test to check for subcommand close in config files

more tests for coverage

generalize section opening and closing

add more tests and some fixes for different configurations

yet more tests of different situations related to configuration files

test more paths for configuration file sections

remove some unused code and fix some codacy warnings

update readme with updates from configuration files

more book edits and README formatting

remove extra space

Apply suggestions from code review

Co-Authored-By: Henry Schreiner <HenrySchreinerIII@gmail.com>

fix some comments and documentation

fix spacing

Rename size_t -> std::size_t

Fix compiler warnings with -Wsign-conversion

Fix new warnings with -Wsign-conversion in PR
2019-12-31 11:28:25 -05: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
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
Jesus Briales
41d3c967d7 Add test for non-const version of App::get_options (#337)
After https://github.com/CLIUtils/CLI11/pull/329 the get_options version being used in the test was the non-const.
Forced testing on non-const by using a const-ref to the app.
Also added testing to ensure the list of options of both const and non-const are the same as expected.
2019-10-27 13:53:54 -04:00
Philip Top
343a730a04 Add needs to subcommand (#317)
* add a needs method to the app/subcommand

* add some needs subcommand tests

* add a few more subcommand tests for needs and alias

* fix shadow warnings

* add some tests of the error pathways and fix a few anomalous conditions on the Option excludes function

* add needs and alias functions in the readme

* add some tests of ignore_case and underscore with the alias operations

* add a few more test cases for needs option groups

* add callback tests with needs and add a few comments in the readme

* update formatting

* add error checks on the aliases and restrictions on valid names for subcommands and aliases

* add checks for matching subcommands and improve error return values to include the offending name

* add some tests of the alias errors

* add some more tests to check subcommand name matching during addition

* add some additional tests and remove a redundant chunk of codes

* add some more checks of subcommand name overlap in option_groups

* allow disabled subcommand to bypass name matching check
2019-10-25 10:21:34 -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
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
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
e9934e058d add transformer and checkedTransformer (#239)
* add transform and checkedTransform tests

add Transformer and CheckedTransformer validators

* Eliminate the Validator description string, some code cleanup

add tests

Make Validators a full Object and remove friend,  move to descriptions instead of overriding type name.

update validators to actually merge the type strings and use all validators in the type outputs

rework join so it works without the start variable,  allow some forwarding references in the validator types, some tests for non-copyable maps, and transforms

merge the search function and enable use of member search function,  make the pair adapters forwarding instead of copying

* add a few more tests and documentation

fix some gcc 4.7 issues and add a few more test cases and more parts of the README

Work on ReadMe and add Bound validator to clamp values

* updates to README.md

* Add some more in TOC of README and fix style in Option.hpp
2019-03-02 12:24:26 +01: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
Henry Schreiner
b4910df3d7
Move to using literals in testing (#213) 2019-02-01 11:32:47 +01:00
Henry Schreiner
0086ddd224
Adding Windows style options default on Windows (#190)
* Adding Windows style options default on Windows

* Fixing test defaults on Windows
2019-01-13 08:29:54 +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
Henry Fredrick Schreiner
3a2c5112a3 Adding missing tests from #185, should hit full coverage again 2019-01-03 13:12:48 +01:00
Philip Top
a83109002c Add ignore underscore (#185)
* add ignore_underscore test cases and options to app

* add ignore_underscore for add_sets and some more tests for the sets and subcommands

* add some documentation lines and some failing tests

* update readme with ignore_underscore option

* remove failing tests from known issue

* remove empty line for code coverage
2019-01-03 09:22:09 +01:00
Henry Fredrick Schreiner
b2e471ac4d Removing set_ for failure_message, footer, name, and callback 2018-06-18 15:13:59 +02:00
Henry Fredrick Schreiner
101d847c29 Use filter fn to simplify, sort includes 2018-05-06 18:36:33 +02:00
Henry Fredrick Schreiner
952f2913e3 First attempt at formatter (app and option)
in progress: formatters

Getting closer

Working on apps

One test actually runs

All builds, added filter functions

Reverting a few behavours as needed

Repairs

All tests pass

Fixing error with adding help flag

Labels are simpler mappings, normalized setters

Adding help_all

Adding a few more tests

One more line tested

Adding one more check

Adding to readme

Simplify naming

Adding default constructors

Fixing spacing issues with subcommand all printout

Adding a couple of tests
2018-04-30 08:17:31 -04:00
Henry Schreiner
bc61342d8e
Removing requires (#112) 2018-04-25 18:33:43 -04:00
Henry Fredrick Schreiner
b17f7ce63a Adding a test for coverage 2018-04-12 08:34:22 +02:00
Henry Fredrick Schreiner
8e650c3873 Adding two required functions 2018-04-11 22:18:22 +02:00
Henry Fredrick Schreiner
447bda047f Adding size instead of expected + unchangable 2018-04-04 20:31:52 +02:00
Henry Fredrick Schreiner
eed238364b Expanding tests 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
268c26ad62 Fix #64 by auto-adding symmetric excludes 2018-03-26 10:56:08 +02:00
Henry Schreiner
5186158442
Rename requires to needs (#82)
* Adding fix for #75, rename requires to needs

* Removing check for install commands (should still be run in subproject)
2018-03-08 11:48:40 +01:00
Henry Fredrick Schreiner
4dac11c025 Finishing addition of ->configurable() 2017-11-28 21:28:37 -05:00
Henry Fredrick Schreiner
954c93d585 Using more powerful policy system, to allow git-like -m options 2017-11-28 15:24:37 -05:00
Henry Fredrick Schreiner
88c680a12b Check that no change doesn't throw 2017-11-26 15:11:48 -05:00
Henry Fredrick Schreiner
2c976808a9 Inherit subcommand values, adding getters and tests 2017-11-22 14:13:28 -05:00
Henry Fredrick Schreiner
10772e5d81 Style fix 2017-11-21 17:10:53 -05:00
Henry Fredrick Schreiner
e371a72f13 Adding test to cover get_subcommands(false) 2017-11-21 15:58:10 -05:00
Henry Fredrick Schreiner
fa5da7deaa Adding tests for inhert, a few fixes 2017-11-20 18:07:13 -05:00
Henry Fredrick Schreiner
5f1df630d7 Adding a couple of tests 2017-11-19 15:18:36 -05:00
Henry Fredrick Schreiner
aae40fbf0e Whitespace fixes 2017-09-06 05:51:12 -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
ee9219e0f8 Adding warnings and fixes, CLI11 target, support for VIM Syntastic 2017-03-27 13:53:57 -04:00
Henry Fredrick Schreiner
7b01535303 Adding a few name tests 2017-03-15 08:19:01 -04:00
Henry Fredrick Schreiner
365315dfdd Adding two more lines to tests 2017-03-14 20:20:03 -04:00
Henry Fredrick Schreiner
cf4f608621 Adding check for invalid positionals 2017-03-09 10:45:52 -05:00
Henry Fredrick Schreiner
58655472f7 IncorrectConstruction 2017-03-08 09:34:08 -05:00
Henry Fredrick Schreiner
e63898df9f Throw errors for duplicate subcommand names, with ignore case too 2017-02-20 15:31:58 -05:00