Commit 0038ad46583fa16f25d75e4987f545474cf6957d

Authored by Henry Schreiner
Committed by Henry Schreiner
1 parent 3c44bb9f

style: run prettier

.ci/azure-build.yml
1 steps: 1 steps:
  2 + - task: CMake@1
  3 + inputs:
  4 + cmakeArgs: .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) -DCMAKE_CXX_STANDARD=$(cli11.std) -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options)
  5 + displayName: "Configure"
2 6
3 -- task: CMake@1  
4 - inputs:  
5 - cmakeArgs: .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) -DCMAKE_CXX_STANDARD=$(cli11.std) -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options)  
6 - displayName: 'Configure'  
7 -  
8 -- script: cmake --build .  
9 - displayName: 'Build'  
10 - workingDirectory: build 7 + - script: cmake --build .
  8 + displayName: "Build"
  9 + workingDirectory: build
.ci/azure-cmake.yml
1 steps: 1 steps:
  2 + # Note that silkeh/clang does not include ca-certificates, so check the shasum for verification
  3 + - bash: |
  4 + wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz"
  5 + echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256
  6 + displayName: Download CMake
2 7
3 -# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification  
4 -- bash: |  
5 - wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz"  
6 - echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256  
7 - displayName: Download CMake 8 + - task: ExtractFiles@1
  9 + inputs:
  10 + archiveFilePatterns: "cmake*.tar.gz"
  11 + destinationFolder: "cmake_program"
  12 + displayName: Extract CMake
8 13
9 -- task: ExtractFiles@1  
10 - inputs:  
11 - archiveFilePatterns: 'cmake*.tar.gz'  
12 - destinationFolder: 'cmake_program'  
13 - displayName: Extract CMake  
14 -  
15 -- bash: echo "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin"  
16 - displayName: Add CMake to PATH 14 + - bash: echo "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin"
  15 + displayName: Add CMake to PATH
.ci/azure-test.yml
1 steps: 1 steps:
  2 + - script: ctest --output-on-failure -C $(cli11.build_type) -T test
  3 + displayName: "Test"
  4 + workingDirectory: build
2 5
3 -- script: ctest --output-on-failure -C $(cli11.build_type) -T test  
4 - displayName: 'Test'  
5 - workingDirectory: build  
6 -  
7 -- task: PublishTestResults@2  
8 - inputs:  
9 - testResultsFormat: 'cTest'  
10 - testResultsFiles: '**/Test.xml' 6 + - task: PublishTestResults@2
  7 + inputs:
  8 + testResultsFormat: "cTest"
  9 + testResultsFiles: "**/Test.xml"
.clang-format
1 -Language: Cpp  
2 -BasedOnStyle: LLVM 1 +Language: Cpp
  2 +BasedOnStyle: LLVM
3 # AccessModifierOffset: -2 3 # AccessModifierOffset: -2
4 # AlignAfterOpenBracket: Align 4 # AlignAfterOpenBracket: Align
5 # AlignConsecutiveAssignments: false 5 # AlignConsecutiveAssignments: false
@@ -37,7 +37,7 @@ BinPackParameters: false @@ -37,7 +37,7 @@ BinPackParameters: false
37 # BreakConstructorInitializersBeforeComma: false 37 # BreakConstructorInitializersBeforeComma: false
38 # BreakAfterJavaFieldAnnotations: false 38 # BreakAfterJavaFieldAnnotations: false
39 # BreakStringLiterals: true 39 # BreakStringLiterals: true
40 -ColumnLimit: 120 40 +ColumnLimit: 120
41 # CommentPragmas: '^ IWYU pragma:' 41 # CommentPragmas: '^ IWYU pragma:'
42 # ConstructorInitializerAllOnOneLineOrOnePerLine: false 42 # ConstructorInitializerAllOnOneLineOrOnePerLine: false
43 # ConstructorInitializerIndentWidth: 4 43 # ConstructorInitializerIndentWidth: 4
@@ -49,7 +49,7 @@ ColumnLimit: 120 @@ -49,7 +49,7 @@ ColumnLimit: 120
49 # ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 49 # ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
50 # IncludeIsMainRegex: '$' 50 # IncludeIsMainRegex: '$'
51 # IndentCaseLabels: false 51 # IndentCaseLabels: false
52 -IndentWidth: 4 52 +IndentWidth: 4
53 # IndentWrappedFunctionNames: false 53 # IndentWrappedFunctionNames: false
54 # JavaScriptQuotes: Leave 54 # JavaScriptQuotes: Leave
55 # JavaScriptWrapImports: true 55 # JavaScriptWrapImports: true
@@ -69,7 +69,7 @@ IndentWidth: 4 @@ -69,7 +69,7 @@ IndentWidth: 4
69 # PenaltyReturnTypeOnItsOwnLine: 60 69 # PenaltyReturnTypeOnItsOwnLine: 60
70 # PointerAlignment: Right 70 # PointerAlignment: Right
71 # ReflowComments: true 71 # ReflowComments: true
72 -SortIncludes: true 72 +SortIncludes: true
73 # SpaceAfterCStyleCast: false 73 # SpaceAfterCStyleCast: false
74 # SpaceAfterTemplateKeyword: true 74 # SpaceAfterTemplateKeyword: true
75 # SpaceBeforeAssignmentOperators: true 75 # SpaceBeforeAssignmentOperators: true
@@ -81,6 +81,6 @@ SpacesBeforeTrailingComments: 2 @@ -81,6 +81,6 @@ SpacesBeforeTrailingComments: 2
81 # SpacesInCStyleCastParentheses: false 81 # SpacesInCStyleCastParentheses: false
82 # SpacesInParentheses: false 82 # SpacesInParentheses: false
83 # SpacesInSquareBrackets: false 83 # SpacesInSquareBrackets: false
84 -Standard: Cpp11  
85 -TabWidth: 4  
86 -UseTab: Never 84 +Standard: Cpp11
  85 +TabWidth: 4
  86 +UseTab: Never
.clang-tidy
@@ -3,22 +3,21 @@ @@ -3,22 +3,21 @@
3 3
4 FormatStyle: file 4 FormatStyle: file
5 5
6 -Checks: '  
7 --*,  
8 -google-*,  
9 --google-runtime-references,  
10 -llvm-include-order,  
11 -llvm-namespace-comment,  
12 -misc-throw-by-value-catch-by-reference,  
13 -modernize*,  
14 --modernize-use-trailing-return-type,  
15 -readability-container-size-empty,  
16 -' 6 +Checks: >
  7 + -*,
  8 + google-*,
  9 + -google-runtime-references,
  10 + llvm-include-order,
  11 + llvm-namespace-comment,
  12 + misc-throw-by-value-catch-by-reference,
  13 + modernize*,
  14 + -modernize-use-trailing-return-type,
  15 + readability-container-size-empty,
17 16
18 -WarningsAsErrors: '*' 17 +WarningsAsErrors: "*"
19 18
20 -HeaderFilterRegex: '.*hpp' 19 +HeaderFilterRegex: ".*hpp"
21 20
22 CheckOptions: 21 CheckOptions:
23 -- key: google-readability-braces-around-statements.ShortStatementLines  
24 - value: '3' 22 + - key: google-readability-braces-around-statements.ShortStatementLines
  23 + value: "3"
.codecov.yml
1 -  
2 ignore: 1 ignore:
3 - "tests" 2 - "tests"
4 - "examples" 3 - "examples"
.github/CONTRIBUTING.md
@@ -8,20 +8,20 @@ Make sure you are comfortable with the license; all contributions are licensed u @@ -8,20 +8,20 @@ Make sure you are comfortable with the license; all contributions are licensed u
8 8
9 Make sure any new functions you add are are: 9 Make sure any new functions you add are are:
10 10
11 -* Documented by `///` documentation for Doxygen  
12 -* Mentioned in the instructions in the README, though brief mentions are okay  
13 -* Explained in your PR (or previously explained in an Issue mentioned in the PR)  
14 -* Completely covered by tests 11 +- Documented by `///` documentation for Doxygen
  12 +- Mentioned in the instructions in the README, though brief mentions are okay
  13 +- Explained in your PR (or previously explained in an Issue mentioned in the PR)
  14 +- Completely covered by tests
15 15
16 In general, make sure the addition is well thought out and does not increase the complexity of CLI11 needlessly. 16 In general, make sure the addition is well thought out and does not increase the complexity of CLI11 needlessly.
17 17
18 ## Things you should know 18 ## Things you should know
19 19
20 -* Once you make the PR, tests will run to make sure your code works on all supported platforms  
21 -* The test coverage is also measured, and that should remain 100%  
22 -* Formatting should be done with pre-commit, otherwise the format check will not pass. However, it is trivial to apply this to your PR, so don't worry about this check. If you do want to run it, see below.  
23 -* Everything must pass clang-tidy as well, run with `-DCLI11_CLANG_TIDY=ON` (if you set `-DCLI11_CLANG_TIDY_OPTIONS="-fix"`, make sure you use a single threaded build process, or just build one example target).  
24 -* Your changes must also conform to most of the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) rules checked by [cpplint](https://github.com/cpplint/cpplint). For unused cpplint filters and justifications, see [CPPLINT.cfg](/CPPLINT.cfg). 20 +- Once you make the PR, tests will run to make sure your code works on all supported platforms
  21 +- The test coverage is also measured, and that should remain 100%
  22 +- Formatting should be done with pre-commit, otherwise the format check will not pass. However, it is trivial to apply this to your PR, so don't worry about this check. If you do want to run it, see below.
  23 +- Everything must pass clang-tidy as well, run with `-DCLI11_CLANG_TIDY=ON` (if you set `-DCLI11_CLANG_TIDY_OPTIONS="-fix"`, make sure you use a single threaded build process, or just build one example target).
  24 +- Your changes must also conform to most of the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) rules checked by [cpplint](https://github.com/cpplint/cpplint). For unused cpplint filters and justifications, see [CPPLINT.cfg](/CPPLINT.cfg).
25 25
26 ## Pre-commit 26 ## Pre-commit
27 27
@@ -74,10 +74,10 @@ Remember to replace the emoji in the readme, being careful not to replace the on @@ -74,10 +74,10 @@ Remember to replace the emoji in the readme, being careful not to replace the on
74 74
75 Steps: 75 Steps:
76 76
77 -* Update changelog if needed  
78 -* Update the version in `.appveyor.yml` and `include/CLI/Version.hpp`.  
79 -* Find and replace in README (new minor/major release only):  
80 - * Replace " ๐Ÿ†•" and "๐Ÿ†• " with "" (ignores the description line)  
81 - * Check for `\/\/$` (vi syntax) to catch leftover `// ๐Ÿ†•`  
82 - * Replace "๐Ÿšง" with "๐Ÿ†•" (manually ignore the description line)  
83 -* Make a release in the GitHub UI, use a name such as "Version X.Y(.Z): Title" 77 +- Update changelog if needed
  78 +- Update the version in `.appveyor.yml` and `include/CLI/Version.hpp`.
  79 +- Find and replace in README (new minor/major release only):
  80 + - Replace " ๐Ÿ†•" and "๐Ÿ†• " with "" (ignores the description line)
  81 + - Check for `\/\/$` (vi syntax) to catch leftover `// ๐Ÿ†•`
  82 + - Replace "๐Ÿšง" with "๐Ÿ†•" (manually ignore the description line)
  83 +- Make a release in the GitHub UI, use a name such as "Version X.Y(.Z): Title"
.github/actions/quick_cmake/action.yml
1 name: Quick CMake config 1 name: Quick CMake config
2 -description: 'Runs CMake 3.4+ (if already setup)' 2 +description: "Runs CMake 3.4+ (if already setup)"
3 inputs: 3 inputs:
4 args: 4 args:
5 - description: 'Other arguments' 5 + description: "Other arguments"
6 required: false 6 required: false
7 - default: '' 7 + default: ""
8 cmake-version: 8 cmake-version:
9 - description: 'The CMake version to run' 9 + description: "The CMake version to run"
10 required: true 10 required: true
11 11
12 runs: 12 runs:
.github/labeler_merged.yml
1 needs changelog: 1 needs changelog:
2 - - all: ['!CHANGELOG.md'] 2 + - all: ["!CHANGELOG.md"]
3 needs README: 3 needs README:
4 - - all: ['!README.md'] 4 + - all: ["!README.md"]
.github/workflows/build.yml
@@ -13,46 +13,45 @@ jobs: @@ -13,46 +13,45 @@ jobs:
13 name: Single header 13 name: Single header
14 runs-on: ubuntu-latest 14 runs-on: ubuntu-latest
15 steps: 15 steps:
16 -  
17 - - uses: actions/checkout@v2  
18 - with:  
19 - submodules: true  
20 -  
21 - - uses: actions/setup-python@v2  
22 -  
23 - - name: Prepare CMake config  
24 - run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON  
25 -  
26 - - name: Make package  
27 - run: cmake --build build --target package_source  
28 -  
29 - - name: Copy source packages  
30 - run: |  
31 - mkdir -p CLI11-Source  
32 - cp build/CLI11-*-Source.* CLI11-Source  
33 - cp build/CLI11-*-Source.* .  
34 -  
35 - - name: Make header  
36 - run: cmake --build build --target CLI11-generate-single-file  
37 -  
38 - - name: Copy file to main folder  
39 - run: cp build/include/CLI11.hpp CLI11.hpp  
40 -  
41 - - uses: actions/upload-artifact@v2  
42 - with:  
43 - name: CLI11.hpp  
44 - path: CLI11.hpp  
45 -  
46 - - uses: actions/upload-artifact@v2  
47 - with:  
48 - name: CLI11-Source  
49 - path: CLI11-Source  
50 -  
51 - - name: Release  
52 - uses: softprops/action-gh-release@v1  
53 - if: startsWith(github.ref, 'refs/tags/')  
54 - with:  
55 - files: |  
56 - CLI11.hpp  
57 - env:  
58 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 + - uses: actions/checkout@v2
  17 + with:
  18 + submodules: true
  19 +
  20 + - uses: actions/setup-python@v2
  21 +
  22 + - name: Prepare CMake config
  23 + run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON
  24 +
  25 + - name: Make package
  26 + run: cmake --build build --target package_source
  27 +
  28 + - name: Copy source packages
  29 + run: |
  30 + mkdir -p CLI11-Source
  31 + cp build/CLI11-*-Source.* CLI11-Source
  32 + cp build/CLI11-*-Source.* .
  33 +
  34 + - name: Make header
  35 + run: cmake --build build --target CLI11-generate-single-file
  36 +
  37 + - name: Copy file to main folder
  38 + run: cp build/include/CLI11.hpp CLI11.hpp
  39 +
  40 + - uses: actions/upload-artifact@v2
  41 + with:
  42 + name: CLI11.hpp
  43 + path: CLI11.hpp
  44 +
  45 + - uses: actions/upload-artifact@v2
  46 + with:
  47 + name: CLI11-Source
  48 + path: CLI11-Source
  49 +
  50 + - name: Release
  51 + uses: softprops/action-gh-release@v1
  52 + if: startsWith(github.ref, 'refs/tags/')
  53 + with:
  54 + files: |
  55 + CLI11.hpp
  56 + env:
  57 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/pr_merged.yml
@@ -9,7 +9,7 @@ jobs: @@ -9,7 +9,7 @@ jobs:
9 runs-on: ubuntu-latest 9 runs-on: ubuntu-latest
10 if: github.event.pull_request.merged == true 10 if: github.event.pull_request.merged == true
11 steps: 11 steps:
12 - - uses: actions/labeler@main  
13 - with:  
14 - repo-token: ${{ secrets.GITHUB_TOKEN }}  
15 - configuration-path: .github/labeler_merged.yml 12 + - uses: actions/labeler@main
  13 + with:
  14 + repo-token: ${{ secrets.GITHUB_TOKEN }}
  15 + configuration-path: .github/labeler_merged.yml
.github/workflows/tests.yml
@@ -12,175 +12,173 @@ jobs: @@ -12,175 +12,173 @@ jobs:
12 runs-on: ubuntu-latest 12 runs-on: ubuntu-latest
13 container: nvidia/cuda:10.2-devel-ubuntu18.04 13 container: nvidia/cuda:10.2-devel-ubuntu18.04
14 steps: 14 steps:
15 - - uses: actions/checkout@v1  
16 - with:  
17 - submodules: true  
18 - - name: Add wget  
19 - run: apt-get update && apt-get install -y wget  
20 - - name: Get cmake  
21 - uses: jwlawson/actions-setup-cmake@v1.12  
22 - - name: Configure  
23 - run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON  
24 - - name: Build  
25 - run: cmake --build build -j2  
26 - 15 + - uses: actions/checkout@v1
  16 + with:
  17 + submodules: true
  18 + - name: Add wget
  19 + run: apt-get update && apt-get install -y wget
  20 + - name: Get cmake
  21 + uses: jwlawson/actions-setup-cmake@v1.12
  22 + - name: Configure
  23 + run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON
  24 + - name: Build
  25 + run: cmake --build build -j2
27 26
28 boost-build: 27 boost-build:
29 name: Boost build 28 name: Boost build
30 runs-on: ubuntu-latest 29 runs-on: ubuntu-latest
31 container: zouzias/boost:1.76.0 30 container: zouzias/boost:1.76.0
32 steps: 31 steps:
33 - - uses: actions/checkout@v1  
34 - with:  
35 - submodules: true  
36 - - name: Add deps  
37 - run: apt-get update && apt-get install make  
38 - - name: Get CMake  
39 - uses: jwlawson/actions-setup-cmake@v1.12  
40 - - name: Configure  
41 - run: cmake -S . -B build -DCLI11_BOOST=ON  
42 - - name: Build  
43 - run: cmake --build build -j2  
44 - - name: Run tests  
45 - run: ctest --output-on-failure  
46 - working-directory: build 32 + - uses: actions/checkout@v1
  33 + with:
  34 + submodules: true
  35 + - name: Add deps
  36 + run: apt-get update && apt-get install make
  37 + - name: Get CMake
  38 + uses: jwlawson/actions-setup-cmake@v1.12
  39 + - name: Configure
  40 + run: cmake -S . -B build -DCLI11_BOOST=ON
  41 + - name: Build
  42 + run: cmake --build build -j2
  43 + - name: Run tests
  44 + run: ctest --output-on-failure
  45 + working-directory: build
47 46
48 meson-build: 47 meson-build:
49 name: Meson build 48 name: Meson build
50 runs-on: ubuntu-latest 49 runs-on: ubuntu-latest
51 steps: 50 steps:
52 - - uses: actions/checkout@v2  
53 -  
54 - - name: Prepare commands  
55 - run: |  
56 - pipx install meson  
57 - pipx install ninja 51 + - uses: actions/checkout@v2
58 52
59 - - name: Configure  
60 - run: meson setup build-meson . -Dtests=true 53 + - name: Prepare commands
  54 + run: |
  55 + pipx install meson
  56 + pipx install ninja
61 57
62 - - name: Build  
63 - run: meson compile -C build-meson 58 + - name: Configure
  59 + run: meson setup build-meson . -Dtests=true
64 60
  61 + - name: Build
  62 + run: meson compile -C build-meson
65 63
66 cmake-config: 64 cmake-config:
67 name: CMake config check 65 name: CMake config check
68 runs-on: ubuntu-latest 66 runs-on: ubuntu-latest
69 steps: 67 steps:
70 - - uses: actions/checkout@v2  
71 -  
72 - - name: Check CMake 3.4  
73 - with:  
74 - cmake-version: "3.4"  
75 - uses: ./.github/actions/quick_cmake  
76 -  
77 - - name: Check CMake 3.5  
78 - uses: ./.github/actions/quick_cmake  
79 - with:  
80 - cmake-version: "3.5"  
81 - if: success() || failure()  
82 -  
83 - - name: Check CMake 3.6  
84 - uses: ./.github/actions/quick_cmake  
85 - with:  
86 - cmake-version: "3.6"  
87 - if: success() || failure()  
88 -  
89 - - name: Check CMake 3.7  
90 - uses: ./.github/actions/quick_cmake  
91 - with:  
92 - cmake-version: "3.7"  
93 - if: success() || failure()  
94 -  
95 - - name: Check CMake 3.8  
96 - uses: ./.github/actions/quick_cmake  
97 - with:  
98 - cmake-version: "3.8"  
99 - if: success() || failure()  
100 -  
101 - - name: Check CMake 3.9  
102 - uses: ./.github/actions/quick_cmake  
103 - with:  
104 - cmake-version: "3.9"  
105 - if: success() || failure()  
106 -  
107 - - name: Check CMake 3.10  
108 - uses: ./.github/actions/quick_cmake  
109 - with:  
110 - cmake-version: "3.10"  
111 - if: success() || failure()  
112 -  
113 - - name: Check CMake 3.11 (full)  
114 - uses: ./.github/actions/quick_cmake  
115 - with:  
116 - cmake-version: "3.11"  
117 - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON  
118 - if: success() || failure()  
119 -  
120 - - name: Check CMake 3.12  
121 - uses: ./.github/actions/quick_cmake  
122 - with:  
123 - cmake-version: "3.12"  
124 - if: success() || failure()  
125 -  
126 - - name: Check CMake 3.13  
127 - uses: ./.github/actions/quick_cmake  
128 - with:  
129 - cmake-version: "3.13"  
130 - if: success() || failure()  
131 -  
132 - - name: Check CMake 3.14  
133 - uses: ./.github/actions/quick_cmake  
134 - with:  
135 - cmake-version: "3.14"  
136 - if: success() || failure()  
137 -  
138 - - name: Check CMake 3.15  
139 - uses: ./.github/actions/quick_cmake  
140 - with:  
141 - cmake-version: "3.15"  
142 - if: success() || failure()  
143 -  
144 - - name: Check CMake 3.16  
145 - uses: ./.github/actions/quick_cmake  
146 - with:  
147 - cmake-version: "3.16"  
148 - if: success() || failure()  
149 -  
150 - - name: Check CMake 3.17  
151 - uses: ./.github/actions/quick_cmake  
152 - with:  
153 - cmake-version: "3.17"  
154 - if: success() || failure()  
155 -  
156 - - name: Check CMake 3.18  
157 - uses: ./.github/actions/quick_cmake  
158 - with:  
159 - cmake-version: "3.18"  
160 - if: success() || failure()  
161 -  
162 - - name: Check CMake 3.19  
163 - uses: ./.github/actions/quick_cmake  
164 - with:  
165 - cmake-version: "3.19"  
166 - if: success() || failure()  
167 -  
168 - - name: Check CMake 3.20  
169 - uses: ./.github/actions/quick_cmake  
170 - with:  
171 - cmake-version: "3.20"  
172 - if: success() || failure()  
173 -  
174 - - name: Check CMake 3.21 (full)  
175 - uses: ./.github/actions/quick_cmake  
176 - with:  
177 - cmake-version: "3.21"  
178 - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON  
179 - if: success() || failure()  
180 -  
181 - - name: Check CMake 3.22 (full)  
182 - uses: ./.github/actions/quick_cmake  
183 - with:  
184 - cmake-version: "3.22"  
185 - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON  
186 - if: success() || failure() 68 + - uses: actions/checkout@v2
  69 +
  70 + - name: Check CMake 3.4
  71 + with:
  72 + cmake-version: "3.4"
  73 + uses: ./.github/actions/quick_cmake
  74 +
  75 + - name: Check CMake 3.5
  76 + uses: ./.github/actions/quick_cmake
  77 + with:
  78 + cmake-version: "3.5"
  79 + if: success() || failure()
  80 +
  81 + - name: Check CMake 3.6
  82 + uses: ./.github/actions/quick_cmake
  83 + with:
  84 + cmake-version: "3.6"
  85 + if: success() || failure()
  86 +
  87 + - name: Check CMake 3.7
  88 + uses: ./.github/actions/quick_cmake
  89 + with:
  90 + cmake-version: "3.7"
  91 + if: success() || failure()
  92 +
  93 + - name: Check CMake 3.8
  94 + uses: ./.github/actions/quick_cmake
  95 + with:
  96 + cmake-version: "3.8"
  97 + if: success() || failure()
  98 +
  99 + - name: Check CMake 3.9
  100 + uses: ./.github/actions/quick_cmake
  101 + with:
  102 + cmake-version: "3.9"
  103 + if: success() || failure()
  104 +
  105 + - name: Check CMake 3.10
  106 + uses: ./.github/actions/quick_cmake
  107 + with:
  108 + cmake-version: "3.10"
  109 + if: success() || failure()
  110 +
  111 + - name: Check CMake 3.11 (full)
  112 + uses: ./.github/actions/quick_cmake
  113 + with:
  114 + cmake-version: "3.11"
  115 + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
  116 + if: success() || failure()
  117 +
  118 + - name: Check CMake 3.12
  119 + uses: ./.github/actions/quick_cmake
  120 + with:
  121 + cmake-version: "3.12"
  122 + if: success() || failure()
  123 +
  124 + - name: Check CMake 3.13
  125 + uses: ./.github/actions/quick_cmake
  126 + with:
  127 + cmake-version: "3.13"
  128 + if: success() || failure()
  129 +
  130 + - name: Check CMake 3.14
  131 + uses: ./.github/actions/quick_cmake
  132 + with:
  133 + cmake-version: "3.14"
  134 + if: success() || failure()
  135 +
  136 + - name: Check CMake 3.15
  137 + uses: ./.github/actions/quick_cmake
  138 + with:
  139 + cmake-version: "3.15"
  140 + if: success() || failure()
  141 +
  142 + - name: Check CMake 3.16
  143 + uses: ./.github/actions/quick_cmake
  144 + with:
  145 + cmake-version: "3.16"
  146 + if: success() || failure()
  147 +
  148 + - name: Check CMake 3.17
  149 + uses: ./.github/actions/quick_cmake
  150 + with:
  151 + cmake-version: "3.17"
  152 + if: success() || failure()
  153 +
  154 + - name: Check CMake 3.18
  155 + uses: ./.github/actions/quick_cmake
  156 + with:
  157 + cmake-version: "3.18"
  158 + if: success() || failure()
  159 +
  160 + - name: Check CMake 3.19
  161 + uses: ./.github/actions/quick_cmake
  162 + with:
  163 + cmake-version: "3.19"
  164 + if: success() || failure()
  165 +
  166 + - name: Check CMake 3.20
  167 + uses: ./.github/actions/quick_cmake
  168 + with:
  169 + cmake-version: "3.20"
  170 + if: success() || failure()
  171 +
  172 + - name: Check CMake 3.21 (full)
  173 + uses: ./.github/actions/quick_cmake
  174 + with:
  175 + cmake-version: "3.21"
  176 + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
  177 + if: success() || failure()
  178 +
  179 + - name: Check CMake 3.22 (full)
  180 + uses: ./.github/actions/quick_cmake
  181 + with:
  182 + cmake-version: "3.22"
  183 + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
  184 + if: success() || failure()
CHANGELOG.md
@@ -2,29 +2,29 @@ @@ -2,29 +2,29 @@
2 2
3 ## Version 2.2: Option and Configuration Flexibility 3 ## Version 2.2: Option and Configuration Flexibility
4 4
5 -New features include support for output of an empty vector, a summing option policy that can be applied more broadly, and an option to validate optional arguments to discriminate from positional arguments. A new validator to check for files on a default path is included to allow one or more default paths for configuration files or other file arguments. A number of bug fixes and code cleanup for various build configurations. Clean up of some error outputs and extension of existing capability to new types or situations.  
6 -  
7 -There is a possible minor breaking change in behavior of certain types which wrapped an integer, such as `std::atomic<int>` or `std::optional<int>` when used in a flag. The default behavior is now as a single argument value vs. summing all the arguments. The default summing behavior is now restricted to pure integral types, int64_t, int, uint32_t, etc. Use the new `sum` multi option policy to revert to the older behavior. The summing behavior on wrapper types was not originally intended.  
8 -  
9 -* Add `MultiOptionPolicy::Sum` and refactor the `add_flag` to fix a bug when using `std::optional<bool>` as type. [#709][]  
10 -* Add support for an empty vector result in TOML and as a default string. [#660][]  
11 -* Add `.validate_optional_arguments()` to support discriminating positional arguments from vector option arguments. [#668][]  
12 -* Add `CLI::FileOnDefaultPath` to check for files on a specified default path. [#698][]  
13 -* Change default value display in help messages from `=XXXX` to `[XXXXX]` to make it clearer. [#666][]  
14 -* Modify the Range Validator to support additional types and clean up the error output. [#690][]  
15 -* Bugfix: The trigger on parse modifier did not work on positional argument.s [#713][]  
16 -* Bugfix: The single header file generation was missing custom namespace generation. [#707][]  
17 -* Bugfix: Clean up File Error handling in the argument processing. [#678][]  
18 -* Bugfix: Fix a stack overflow error if nameless commands had fallthrough. [#665][]  
19 -* Bugfix: A subcommand callback could be executed multiple times if it was a member of an option group. [#666][]  
20 -* Bugfix: Fix an issue with vectors of multi argument types where partial argument sets did not result in an error. [#661][]  
21 -* Bugfix: Fix an issue with type the template matching on C++20 and add some CI builds for C++20. [#663][]  
22 -* Bugfix: Fix typo in C++20 detection on MSVC. [#706][]  
23 -* Bugfix: An issue where the detection of RTTI being disabled on certain MSVC platforms did not disable the use of dynamic cast calls. [#666][]  
24 -* Bugfix: Resolve strict-overflow warning on some GCC compilers. [#666][]  
25 -* Backend: Add additional tests concerning the use of aliases for option groups in config files. [#666][]  
26 -* Build: Add support for testing in meson and cleanup symbolic link generation. [#701][], [#697][]  
27 -* Build: Support building in WebAssembly. [#679][] 5 +New features include support for output of an empty vector, a summing option policy that can be applied more broadly, and an option to validate optional arguments to discriminate from positional arguments. A new validator to check for files on a default path is included to allow one or more default paths for configuration files or other file arguments. A number of bug fixes and code cleanup for various build configurations. Clean up of some error outputs and extension of existing capability to new types or situations.
  6 +
  7 +There is a possible minor breaking change in behavior of certain types which wrapped an integer, such as `std::atomic<int>` or `std::optional<int>` when used in a flag. The default behavior is now as a single argument value vs. summing all the arguments. The default summing behavior is now restricted to pure integral types, int64_t, int, uint32_t, etc. Use the new `sum` multi option policy to revert to the older behavior. The summing behavior on wrapper types was not originally intended.
  8 +
  9 +- Add `MultiOptionPolicy::Sum` and refactor the `add_flag` to fix a bug when using `std::optional<bool>` as type. [#709][]
  10 +- Add support for an empty vector result in TOML and as a default string. [#660][]
  11 +- Add `.validate_optional_arguments()` to support discriminating positional arguments from vector option arguments. [#668][]
  12 +- Add `CLI::FileOnDefaultPath` to check for files on a specified default path. [#698][]
  13 +- Change default value display in help messages from `=XXXX` to `[XXXXX]` to make it clearer. [#666][]
  14 +- Modify the Range Validator to support additional types and clean up the error output. [#690][]
  15 +- Bugfix: The trigger on parse modifier did not work on positional argument.s [#713][]
  16 +- Bugfix: The single header file generation was missing custom namespace generation. [#707][]
  17 +- Bugfix: Clean up File Error handling in the argument processing. [#678][]
  18 +- Bugfix: Fix a stack overflow error if nameless commands had fallthrough. [#665][]
  19 +- Bugfix: A subcommand callback could be executed multiple times if it was a member of an option group. [#666][]
  20 +- Bugfix: Fix an issue with vectors of multi argument types where partial argument sets did not result in an error. [#661][]
  21 +- Bugfix: Fix an issue with type the template matching on C++20 and add some CI builds for C++20. [#663][]
  22 +- Bugfix: Fix typo in C++20 detection on MSVC. [#706][]
  23 +- Bugfix: An issue where the detection of RTTI being disabled on certain MSVC platforms did not disable the use of dynamic cast calls. [#666][]
  24 +- Bugfix: Resolve strict-overflow warning on some GCC compilers. [#666][]
  25 +- Backend: Add additional tests concerning the use of aliases for option groups in config files. [#666][]
  26 +- Build: Add support for testing in meson and cleanup symbolic link generation. [#701][], [#697][]
  27 +- Build: Support building in WebAssembly. [#679][]
28 28
29 [#660]: https://github.com/CLIUtils/CLI11/pull/660 29 [#660]: https://github.com/CLIUtils/CLI11/pull/660
30 [#661]: https://github.com/CLIUtils/CLI11/pull/661 30 [#661]: https://github.com/CLIUtils/CLI11/pull/661
@@ -52,12 +52,12 @@ improved, allowing your configuration to sit in a larger file. And option @@ -52,12 +52,12 @@ improved, allowing your configuration to sit in a larger file. And option
52 callbacks have a few new settings, allowing them to be run even if the option 52 callbacks have a few new settings, allowing them to be run even if the option
53 is not passed, or every time the option is parsed. 53 is not passed, or every time the option is parsed.
54 54
55 -* Option/subcommand name restrictions have been relaxed. Most characters are now allowed. [#627][]  
56 -* The config parser can accept streams, specify a specific section, and inline comment characters are supported [#630][]  
57 -* `force_callback` & `trigger_on_parse` added, allowing a callback to always run on parse even if not present or every time the option is parsed [#631][]  
58 -* Bugfix(cmake): Only add `CONFIGURE_DEPENDS` if CLI11 is the main project [#633][]  
59 -* Bugfix(cmake): Ensure the cmake/pkg-config files install to a arch independent path [#635][]  
60 -* Bugfix: The single header file generation was missing the include guard. [#620][] 55 +- Option/subcommand name restrictions have been relaxed. Most characters are now allowed. [#627][]
  56 +- The config parser can accept streams, specify a specific section, and inline comment characters are supported [#630][]
  57 +- `force_callback` & `trigger_on_parse` added, allowing a callback to always run on parse even if not present or every time the option is parsed [#631][]
  58 +- Bugfix(cmake): Only add `CONFIGURE_DEPENDS` if CLI11 is the main project [#633][]
  59 +- Bugfix(cmake): Ensure the cmake/pkg-config files install to a arch independent path [#635][]
  60 +- Bugfix: The single header file generation was missing the include guard. [#620][]
61 61
62 [#620]: https://github.com/CLIUtils/CLI11/pull/620 62 [#620]: https://github.com/CLIUtils/CLI11/pull/620
63 [#627]: https://github.com/CLIUtils/CLI11/pull/627 63 [#627]: https://github.com/CLIUtils/CLI11/pull/627
@@ -68,9 +68,9 @@ is not passed, or every time the option is parsed. @@ -68,9 +68,9 @@ is not passed, or every time the option is parsed.
68 68
69 ### Version 2.1.1: Quick Windows fix 69 ### Version 2.1.1: Quick Windows fix
70 70
71 -* A collision with `min`/`max` macros on Windows has been fixed. [#642][]  
72 -* Tests pass with Boost again [#646][]  
73 -* Running the pre-commit hooks in development no longer requires docker for clang-format [#647][] 71 +- A collision with `min`/`max` macros on Windows has been fixed. [#642][]
  72 +- Tests pass with Boost again [#646][]
  73 +- Running the pre-commit hooks in development no longer requires docker for clang-format [#647][]
74 74
75 [#642]: https://github.com/CLIUtils/CLI11/pull/642 75 [#642]: https://github.com/CLIUtils/CLI11/pull/642
76 [#646]: https://github.com/CLIUtils/CLI11/pull/646 76 [#646]: https://github.com/CLIUtils/CLI11/pull/646
@@ -78,11 +78,11 @@ is not passed, or every time the option is parsed. @@ -78,11 +78,11 @@ is not passed, or every time the option is parsed.
78 78
79 ## Version 2.1.2: Better subproject builds 79 ## Version 2.1.2: Better subproject builds
80 80
81 -* Use `main` for the main branch of the repository [#657][]  
82 -* Bugfix(cmake): Enforce at least C++11 when using CMake target [#656][]  
83 -* Build: Don't run doxygen and CTest includes if a submodule [#656][]  
84 -* Build: Avoid a warning on CMake 3.22 [#656][]  
85 -* Build: Support compiling the tests with an external copy of Catch2 [#653][] 81 +- Use `main` for the main branch of the repository [#657][]
  82 +- Bugfix(cmake): Enforce at least C++11 when using CMake target [#656][]
  83 +- Build: Don't run doxygen and CTest includes if a submodule [#656][]
  84 +- Build: Avoid a warning on CMake 3.22 [#656][]
  85 +- Build: Support compiling the tests with an external copy of Catch2 [#653][]
86 86
87 [#653]: https://github.com/CLIUtils/CLI11/pull/653 87 [#653]: https://github.com/CLIUtils/CLI11/pull/653
88 [#656]: https://github.com/CLIUtils/CLI11/pull/656 88 [#656]: https://github.com/CLIUtils/CLI11/pull/656
@@ -94,38 +94,38 @@ This version focuses on cleaning up deprecated functionality, and some minor @@ -94,38 +94,38 @@ This version focuses on cleaning up deprecated functionality, and some minor
94 default changes. The config processing is TOML compliant now. Atomics and 94 default changes. The config processing is TOML compliant now. Atomics and
95 complex numbers are directly supported, along with other container 95 complex numbers are directly supported, along with other container
96 improvements. A new version flag option has finally been added. Subcommands are 96 improvements. A new version flag option has finally been added. Subcommands are
97 -significantly improved with new features and bugfixes for corner cases. This 97 +significantly improved with new features and bugfixes for corner cases. This
98 release contains a lot of backend cleanup, including a complete overhaul of the 98 release contains a lot of backend cleanup, including a complete overhaul of the
99 testing system and single file generation system. 99 testing system and single file generation system.
100 100
101 -* Built-in config format is TOML compliant now [#435][]  
102 - * Support multiline TOML [#528][]  
103 - * Support for configurable quotes [#599][]  
104 - * Support short/positional options in config mode [#443][]  
105 -* More powerful containers, support for `%%` separator [#423][]  
106 -* Support atomic types [#520][] and complex types natively [#423][]  
107 -* Add a type validator `CLI::TypeValidator<TYPE>` [#526][]  
108 -* Add a version flag easily [#452][], with help message [#601][]  
109 -* Support `->silent()` on subcommands. [#529][]  
110 -* Add alias section to help for subcommands [#545][]  
111 -* Allow quotes to specify a program name [#605][]  
112 -* Backend: redesigned MakeSingleFiles to have a higher level of manual control, to support future features. [#546][]  
113 -* Backend: moved testing from GTest to Catch2 [#574][]  
114 -* Bugfix: avoid duplicated and missed calls to the final callback [#584][]  
115 -* Bugfix: support embedded newlines in more places [#592][]  
116 -* Bugfix: avoid listing helpall as a required flag [#530][]  
117 -* Bugfix: avoid a clash with WINDOWS define [#563][]  
118 -* Bugfix: the help flag didn't get processed when a config file was required [#606][]  
119 -* Bugfix: fix description of non-configurable subcommands in config [#604][]  
120 -* Build: support pkg-config [#523][] 101 +- Built-in config format is TOML compliant now [#435][]
  102 + - Support multiline TOML [#528][]
  103 + - Support for configurable quotes [#599][]
  104 + - Support short/positional options in config mode [#443][]
  105 +- More powerful containers, support for `%%` separator [#423][]
  106 +- Support atomic types [#520][] and complex types natively [#423][]
  107 +- Add a type validator `CLI::TypeValidator<TYPE>` [#526][]
  108 +- Add a version flag easily [#452][], with help message [#601][]
  109 +- Support `->silent()` on subcommands. [#529][]
  110 +- Add alias section to help for subcommands [#545][]
  111 +- Allow quotes to specify a program name [#605][]
  112 +- Backend: redesigned MakeSingleFiles to have a higher level of manual control, to support future features. [#546][]
  113 +- Backend: moved testing from GTest to Catch2 [#574][]
  114 +- Bugfix: avoid duplicated and missed calls to the final callback [#584][]
  115 +- Bugfix: support embedded newlines in more places [#592][]
  116 +- Bugfix: avoid listing helpall as a required flag [#530][]
  117 +- Bugfix: avoid a clash with WINDOWS define [#563][]
  118 +- Bugfix: the help flag didn't get processed when a config file was required [#606][]
  119 +- Bugfix: fix description of non-configurable subcommands in config [#604][]
  120 +- Build: support pkg-config [#523][]
121 121
122 > ### Converting from CLI11 1.9 122 > ### Converting from CLI11 1.9
123 > 123 >
124 -> * Removed deprecated set commands, use validators instead. [#565][]  
125 -> * The final "defaulted" bool has been removed, use `->capture_default_str()` 124 +> - Removed deprecated set commands, use validators instead. [#565][]
  125 +> - The final "defaulted" bool has been removed, use `->capture_default_str()`
126 > instead. Use `app.option_defaults()->always_capture_default()` to set this for 126 > instead. Use `app.option_defaults()->always_capture_default()` to set this for
127 > all future options. [#597][] 127 > all future options. [#597][]
128 -> * Use `add_option` on a complex number instead of `add_complex`, which has been removed. 128 +> - Use `add_option` on a complex number instead of `add_complex`, which has been removed.
129 129
130 [#423]: https://github.com/CLIUtils/CLI11/pull/423 130 [#423]: https://github.com/CLIUtils/CLI11/pull/423
131 [#435]: https://github.com/CLIUtils/CLI11/pull/435 131 [#435]: https://github.com/CLIUtils/CLI11/pull/435
@@ -157,44 +157,44 @@ Config file handling was revamped to fix common issues, and now supports reading @@ -157,44 +157,44 @@ Config file handling was revamped to fix common issues, and now supports reading
157 157
158 Adding options is significantly more powerful with support for things like 158 Adding options is significantly more powerful with support for things like
159 `std::tuple` and `std::array`, including with transforms. Several new 159 `std::tuple` and `std::array`, including with transforms. Several new
160 -configuration options were added to facilitate a wider variety of apps. GCC 160 +configuration options were added to facilitate a wider variety of apps. GCC
161 4.7 is no longer supported. 161 4.7 is no longer supported.
162 162
163 -* Config files refactored, supports TOML (may become default output in 2.0) [#362][]  
164 -* Added two template parameter form of `add_option`, allowing `std::optional` to be supported without a special import [#285][]  
165 -* `string_view` now supported in reasonable places [#300][], [#285][]  
166 -* `immediate_callback`, `final_callback`, and `parse_complete_callback` added to support controlling the App callback order [#292][], [#313][]  
167 -* Multiple positional arguments maintain order if `positionals_at_end` is set. [#306][]  
168 -* Pair/tuple/array now supported, and validators indexed to specific components in the objects [#307][], [#310][]  
169 -* Footer callbacks supported [#309][]  
170 -* Subcommands now support needs (including nameless subcommands) [#317][]  
171 -* More flexible type size, more useful `add_complex` [#325][], [#370][]  
172 -* Added new validators `CLI::NonNegativeNumber` and `CLI::PositiveNumber` [#342][]  
173 -* Transform now supports arrays [#349][]  
174 -* Option groups can be hidden [#356][]  
175 -* Add `CLI::deprecate_option` and `CLI::retire_option` functions [#358][]  
176 -* More flexible and safer Option `default_val` [#387][]  
177 -* Backend: Cleaner type traits [#286][]  
178 -* Backend: File checking updates [#341][]  
179 -* Backend: Using pre-commit to format, checked in GitHub Actions [#336][]  
180 -* Backend: Clang-tidy checked again, CMake option now `CL11_CLANG_TIDY` [#390][]  
181 -* Backend: Warning cleanup, more checks from klocwork [#350][], Effective C++ [#354][], clang-tidy [#360][], CUDA NVCC [#365][], cross compile [#373][], sign conversion [#382][], and cpplint [#400][]  
182 -* Docs: CLI11 Tutorial now hosted in the same repository [#304][], [#318][], [#374][]  
183 -* Bugfix: Fixed undefined behavior in `checked_multiply` [#290][]  
184 -* Bugfix: `->check()` was adding the name to the wrong validator [#320][]  
185 -* Bugfix: Resetting config option works properly [#301][]  
186 -* Bugfix: Hidden flags were showing up in error printout [#333][]  
187 -* Bugfix: Enum conversion no longer broken if stream operator added [#348][]  
188 -* Build: The meson build system supported [#299][]  
189 -* Build: GCC 4.7 is no longer supported, due mostly to GoogleTest. GCC 4.8+ is now required. [#160][]  
190 -* Build: Restructured significant portions of CMake build system [#394][] 163 +- Config files refactored, supports TOML (may become default output in 2.0) [#362][]
  164 +- Added two template parameter form of `add_option`, allowing `std::optional` to be supported without a special import [#285][]
  165 +- `string_view` now supported in reasonable places [#300][], [#285][]
  166 +- `immediate_callback`, `final_callback`, and `parse_complete_callback` added to support controlling the App callback order [#292][], [#313][]
  167 +- Multiple positional arguments maintain order if `positionals_at_end` is set. [#306][]
  168 +- Pair/tuple/array now supported, and validators indexed to specific components in the objects [#307][], [#310][]
  169 +- Footer callbacks supported [#309][]
  170 +- Subcommands now support needs (including nameless subcommands) [#317][]
  171 +- More flexible type size, more useful `add_complex` [#325][], [#370][]
  172 +- Added new validators `CLI::NonNegativeNumber` and `CLI::PositiveNumber` [#342][]
  173 +- Transform now supports arrays [#349][]
  174 +- Option groups can be hidden [#356][]
  175 +- Add `CLI::deprecate_option` and `CLI::retire_option` functions [#358][]
  176 +- More flexible and safer Option `default_val` [#387][]
  177 +- Backend: Cleaner type traits [#286][]
  178 +- Backend: File checking updates [#341][]
  179 +- Backend: Using pre-commit to format, checked in GitHub Actions [#336][]
  180 +- Backend: Clang-tidy checked again, CMake option now `CL11_CLANG_TIDY` [#390][]
  181 +- Backend: Warning cleanup, more checks from klocwork [#350][], Effective C++ [#354][], clang-tidy [#360][], CUDA NVCC [#365][], cross compile [#373][], sign conversion [#382][], and cpplint [#400][]
  182 +- Docs: CLI11 Tutorial now hosted in the same repository [#304][], [#318][], [#374][]
  183 +- Bugfix: Fixed undefined behavior in `checked_multiply` [#290][]
  184 +- Bugfix: `->check()` was adding the name to the wrong validator [#320][]
  185 +- Bugfix: Resetting config option works properly [#301][]
  186 +- Bugfix: Hidden flags were showing up in error printout [#333][]
  187 +- Bugfix: Enum conversion no longer broken if stream operator added [#348][]
  188 +- Build: The meson build system supported [#299][]
  189 +- Build: GCC 4.7 is no longer supported, due mostly to GoogleTest. GCC 4.8+ is now required. [#160][]
  190 +- Build: Restructured significant portions of CMake build system [#394][]
191 191
192 > ### Converting from CLI11 1.8 192 > ### Converting from CLI11 1.8
193 > 193 >
194 -> * Some deprecated methods dropped  
195 -> * `add_set*` should be replaced with `->check`/`->transform` and `CLI::IsMember` since 1.8  
196 -> * `get_defaultval` was replaced by `get_default_str` in 1.8  
197 -> * The true/false 4th argument to `add_option` is expected to be removed in 2.0, use `->capture_default_str()` since 1.8 194 +> - Some deprecated methods dropped
  195 +> - `add_set*` should be replaced with `->check`/`->transform` and `CLI::IsMember` since 1.8
  196 +> - `get_defaultval` was replaced by `get_default_str` in 1.8
  197 +> - The true/false 4th argument to `add_option` is expected to be removed in 2.0, use `->capture_default_str()` since 1.8
198 198
199 [#160]: https://github.com/CLIUtils/CLI11/pull/160 199 [#160]: https://github.com/CLIUtils/CLI11/pull/160
200 [#285]: https://github.com/CLIUtils/CLI11/pull/285 200 [#285]: https://github.com/CLIUtils/CLI11/pull/285
@@ -240,13 +240,13 @@ configuration options were added to facilitate a wider variety of apps. GCC @@ -240,13 +240,13 @@ configuration options were added to facilitate a wider variety of apps. GCC
240 240
241 This is a patch version that backports fixes from the development of 2.0. 241 This is a patch version that backports fixes from the development of 2.0.
242 242
243 -* Support relative inclusion [#475][]  
244 -* Fix cases where spaces in paths could break CMake support [#471][]  
245 -* Fix an issue with string conversion [#421][]  
246 -* Cross-compiling improvement for Conan.io [#430][]  
247 -* Fix option group default propagation [#450][]  
248 -* Fix for C++20 [#459][]  
249 -* Support compiling with RTTI off [#461][] 243 +- Support relative inclusion [#475][]
  244 +- Fix cases where spaces in paths could break CMake support [#471][]
  245 +- Fix an issue with string conversion [#421][]
  246 +- Cross-compiling improvement for Conan.io [#430][]
  247 +- Fix option group default propagation [#450][]
  248 +- Fix for C++20 [#459][]
  249 +- Support compiling with RTTI off [#461][]
250 250
251 [#421]: https://github.com/CLIUtils/CLI11/pull/421 251 [#421]: https://github.com/CLIUtils/CLI11/pull/421
252 [#430]: https://github.com/CLIUtils/CLI11/pull/430 252 [#430]: https://github.com/CLIUtils/CLI11/pull/430
@@ -260,39 +260,39 @@ This is a patch version that backports fixes from the development of 2.0. @@ -260,39 +260,39 @@ This is a patch version that backports fixes from the development of 2.0.
260 260
261 Set handling has been completely replaced by a new backend that works as a Validator or Transformer. This provides a single interface instead of the 16 different functions in App. It also allows ordered collections to be used, custom functions for filtering, and better help and error messages. You can also use a collection of pairs (like `std::map`) to transform the match into an output. Also new are inverted flags, which can cancel or reduce the count of flags, and can also support general flag types. A new `add_option_fn` lets you more easily program CLI11 options with the types you choose. Vector options now support a custom separator. Apps can now be composed with unnamed subcommand support. The final bool "defaults" flag when creating options has been replaced by `->capture_default_str()` (ending an old limitation in construction made this possible); the old method is still available but may be removed in future versions. 261 Set handling has been completely replaced by a new backend that works as a Validator or Transformer. This provides a single interface instead of the 16 different functions in App. It also allows ordered collections to be used, custom functions for filtering, and better help and error messages. You can also use a collection of pairs (like `std::map`) to transform the match into an output. Also new are inverted flags, which can cancel or reduce the count of flags, and can also support general flag types. A new `add_option_fn` lets you more easily program CLI11 options with the types you choose. Vector options now support a custom separator. Apps can now be composed with unnamed subcommand support. The final bool "defaults" flag when creating options has been replaced by `->capture_default_str()` (ending an old limitation in construction made this possible); the old method is still available but may be removed in future versions.
262 262
263 -* Replaced default help capture: `.add_option("name", value, "", True)` becomes `.add_option("name", value)->capture_default_str()` [#242][]  
264 -* Added `.always_capture_default()` [#242][]  
265 -* New `CLI::IsMember` validator replaces set validation [#222][]  
266 -* `IsMember` also supports container of pairs, transform allows modification of result [#228][]  
267 -* Added new Transformers, `CLI::AsNumberWithUnit` and `CLI::AsSizeValue` [#253][]  
268 -* Much more powerful flags with different values [#211][], general types [#235][]  
269 -* `add_option` now supports bool due to unified bool handling [#211][]  
270 -* Support for composable unnamed subcommands [#216][]  
271 -* Reparsing is better supported with `.remaining_for_passthrough()` [#265][]  
272 -* Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][]  
273 -* Validators added for IP4 addresses and positive numbers [#210][] and numbers [#262][]  
274 -* Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][]  
275 -* Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][]  
276 -* Added `validate_positionals` [#262][]  
277 -* Positional parsing is much more powerful [#251][], duplicates supported [#247][]  
278 -* Validators can be negated with `!` [#230][], and now handle tname functions [#228][]  
279 -* Better enum support and streaming helper [#233][] and [#228][]  
280 -* Cleanup for shadow warnings [#232][]  
281 -* Better alignment on multiline descriptions [#269][]  
282 -* Better support for aarch64 [#266][]  
283 -* Respect `BUILD_TESTING` only if CLI11 is the main project; otherwise, `CLI11_TESTING` must be used [#277][]  
284 -* Drop auto-detection of experimental optional and boost::optional; must be enabled explicitly (too fragile) [#277][] [#279][] 263 +- Replaced default help capture: `.add_option("name", value, "", True)` becomes `.add_option("name", value)->capture_default_str()` [#242][]
  264 +- Added `.always_capture_default()` [#242][]
  265 +- New `CLI::IsMember` validator replaces set validation [#222][]
  266 +- `IsMember` also supports container of pairs, transform allows modification of result [#228][]
  267 +- Added new Transformers, `CLI::AsNumberWithUnit` and `CLI::AsSizeValue` [#253][]
  268 +- Much more powerful flags with different values [#211][], general types [#235][]
  269 +- `add_option` now supports bool due to unified bool handling [#211][]
  270 +- Support for composable unnamed subcommands [#216][]
  271 +- Reparsing is better supported with `.remaining_for_passthrough()` [#265][]
  272 +- Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][]
  273 +- Validators added for IP4 addresses and positive numbers [#210][] and numbers [#262][]
  274 +- Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][]
  275 +- Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][]
  276 +- Added `validate_positionals` [#262][]
  277 +- Positional parsing is much more powerful [#251][], duplicates supported [#247][]
  278 +- Validators can be negated with `!` [#230][], and now handle tname functions [#228][]
  279 +- Better enum support and streaming helper [#233][] and [#228][]
  280 +- Cleanup for shadow warnings [#232][]
  281 +- Better alignment on multiline descriptions [#269][]
  282 +- Better support for aarch64 [#266][]
  283 +- Respect `BUILD_TESTING` only if CLI11 is the main project; otherwise, `CLI11_TESTING` must be used [#277][]
  284 +- Drop auto-detection of experimental optional and boost::optional; must be enabled explicitly (too fragile) [#277][] [#279][]
285 285
286 > ### Converting from CLI11 1.7 286 > ### Converting from CLI11 1.7
287 > 287 >
288 -> * `.add_option(..., true)` should be replaced by `.add_option(...)->capture_default_str()` or `app.option_defaults()->always_capture_default()` can be used  
289 -> * `app.add_set("--name", value, {"choice1", "choice2"})` should become `app.add_option("--name", value)->check(CLI::IsMember({"choice1", "choice2"}))`  
290 -> * The `_ignore_case` version of this can be replaced by adding `CLI::ignore_case` to the argument list in `IsMember`  
291 -> * The `_ignore_underscore` version of this can be replaced by adding `CLI::ignore_underscore` to the argument list in `IsMember`  
292 -> * The `_ignore_case_underscore` version of this can be replaced by adding both functions listed above to the argument list in `IsMember`  
293 -> * If you want an exact match to the original choice after one of the modifier functions matches, use `->transform` instead of `->check`  
294 -> * The `_mutable` versions of this can be replaced by passing a pointer or shared pointer into `IsMember`  
295 -> * An error with sets now produces a `ValidationError` instead of a `ConversionError` 288 +> - `.add_option(..., true)` should be replaced by `.add_option(...)->capture_default_str()` or `app.option_defaults()->always_capture_default()` can be used
  289 +> - `app.add_set("--name", value, {"choice1", "choice2"})` should become `app.add_option("--name", value)->check(CLI::IsMember({"choice1", "choice2"}))`
  290 +> - The `_ignore_case` version of this can be replaced by adding `CLI::ignore_case` to the argument list in `IsMember`
  291 +> - The `_ignore_underscore` version of this can be replaced by adding `CLI::ignore_underscore` to the argument list in `IsMember`
  292 +> - The `_ignore_case_underscore` version of this can be replaced by adding both functions listed above to the argument list in `IsMember`
  293 +> - If you want an exact match to the original choice after one of the modifier functions matches, use `->transform` instead of `->check`
  294 +> - The `_mutable` versions of this can be replaced by passing a pointer or shared pointer into `IsMember`
  295 +> - An error with sets now produces a `ValidationError` instead of a `ConversionError`
296 296
297 [#209]: https://github.com/CLIUtils/CLI11/pull/209 297 [#209]: https://github.com/CLIUtils/CLI11/pull/209
298 [#210]: https://github.com/CLIUtils/CLI11/pull/210 298 [#210]: https://github.com/CLIUtils/CLI11/pull/210
@@ -324,26 +324,26 @@ Set handling has been completely replaced by a new backend that works as a Valid @@ -324,26 +324,26 @@ Set handling has been completely replaced by a new backend that works as a Valid
324 The parsing procedure now maps much more sensibly to complex, nested subcommand structures. Each phase of the parsing happens on all subcommands before moving on with the next phase of the parse. This allows several features, like required environment variables, to work properly even through subcommand boundaries. 324 The parsing procedure now maps much more sensibly to complex, nested subcommand structures. Each phase of the parsing happens on all subcommands before moving on with the next phase of the parse. This allows several features, like required environment variables, to work properly even through subcommand boundaries.
325 Passing the same subcommand multiple times is better supported. Several new features were added as well, including Windows style option support, parsing strings directly, and ignoring underscores in names. Adding a set that you plan to change later must now be done with `add_mutable_set`. 325 Passing the same subcommand multiple times is better supported. Several new features were added as well, including Windows style option support, parsing strings directly, and ignoring underscores in names. Adding a set that you plan to change later must now be done with `add_mutable_set`.
326 326
327 -* Support Windows style options with `->allow_windows_style_options`. [#187][] On by default on Windows. [#190][]  
328 -* Added `parse(string)` to split up and parse a command-line style string directly. [#186][]  
329 -* Added `ignore_underscore` and related functions, to ignore underscores when matching names. [#185][]  
330 -* The default INI Config will now add quotes to strings with spaces [#195][]  
331 -* The default message now will mention the help-all flag also if present [#197][]  
332 -* Added `->description` to set Option descriptions [#199][]  
333 -* Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][]  
334 -* Subcommands now track how many times they were parsed in a parsing process. `count()` with no arguments will return the number of times a subcommand was encountered. [#178][]  
335 -* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#178][]  
336 -* Calling parse multiple times is now officially supported without `clear` (automatic). [#178][]  
337 -* Dropped the mostly undocumented `short_circuit` property, as help flag parsing is a bit more complex, and the default callback behavior of options now works properly. [#179][]  
338 -* Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][]  
339 -* Cleanup warnings [#191][]  
340 -* Remove deprecated names: `set_footer`, `set_name`, `set_callback`, and `set_type_name`. Use without the `set_` instead. [#192][] 327 +- Support Windows style options with `->allow_windows_style_options`. [#187][] On by default on Windows. [#190][]
  328 +- Added `parse(string)` to split up and parse a command-line style string directly. [#186][]
  329 +- Added `ignore_underscore` and related functions, to ignore underscores when matching names. [#185][]
  330 +- The default INI Config will now add quotes to strings with spaces [#195][]
  331 +- The default message now will mention the help-all flag also if present [#197][]
  332 +- Added `->description` to set Option descriptions [#199][]
  333 +- Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][]
  334 +- Subcommands now track how many times they were parsed in a parsing process. `count()` with no arguments will return the number of times a subcommand was encountered. [#178][]
  335 +- Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#178][]
  336 +- Calling parse multiple times is now officially supported without `clear` (automatic). [#178][]
  337 +- Dropped the mostly undocumented `short_circuit` property, as help flag parsing is a bit more complex, and the default callback behavior of options now works properly. [#179][]
  338 +- Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][]
  339 +- Cleanup warnings [#191][]
  340 +- Remove deprecated names: `set_footer`, `set_name`, `set_callback`, and `set_type_name`. Use without the `set_` instead. [#192][]
341 341
342 > ### Converting from CLI11 1.6 342 > ### Converting from CLI11 1.6
343 > 343 >
344 -> * `->short_circuit()` is no longer needed, just remove it if you were using it - raising an exception will happen in the proper place now without it.  
345 -> * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature  
346 -> * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously). 344 +> - `->short_circuit()` is no longer needed, just remove it if you were using it - raising an exception will happen in the proper place now without it.
  345 +> - `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature
  346 +> - `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously).
347 347
348 [#178]: https://github.com/CLIUtils/CLI11/pull/178 348 [#178]: https://github.com/CLIUtils/CLI11/pull/178
349 [#183]: https://github.com/CLIUtils/CLI11/pull/183 349 [#183]: https://github.com/CLIUtils/CLI11/pull/183
@@ -362,9 +362,9 @@ Passing the same subcommand multiple times is better supported. Several new feat @@ -362,9 +362,9 @@ Passing the same subcommand multiple times is better supported. Several new feat
362 362
363 This version provides a quick patch for a (correct) warning from GCC 8 for the windows options code. 363 This version provides a quick patch for a (correct) warning from GCC 8 for the windows options code.
364 364
365 -* Fix for Windows style option parsing [#201][]  
366 -* Improve `add_subcommand` when throwing an exception [#204][]  
367 -* Better metadata for Conan package [#202][] 365 +- Fix for Windows style option parsing [#201][]
  366 +- Improve `add_subcommand` when throwing an exception [#204][]
  367 +- Better metadata for Conan package [#202][]
368 368
369 [#201]: https://github.com/CLIUtils/CLI11/pull/201 369 [#201]: https://github.com/CLIUtils/CLI11/pull/201
370 [#202]: https://github.com/CLIUtils/CLI11/pull/202 370 [#202]: https://github.com/CLIUtils/CLI11/pull/202
@@ -374,64 +374,64 @@ This version provides a quick patch for a (correct) warning from GCC 8 for the w @@ -374,64 +374,64 @@ This version provides a quick patch for a (correct) warning from GCC 8 for the w
374 374
375 Added a new formatting system [#109][]. You can now set the formatter on Apps. This has also simplified the internals of Apps and Options a bit by separating most formatting code. 375 Added a new formatting system [#109][]. You can now set the formatter on Apps. This has also simplified the internals of Apps and Options a bit by separating most formatting code.
376 376
377 -* Added `CLI::Formatter` and `formatter` slot for apps, inherited.  
378 -* `FormatterBase` is the minimum required.  
379 -* `FormatterLambda` provides for the easy addition of an arbitrary function.  
380 -* Added `help_all` support (not added by default). 377 +- Added `CLI::Formatter` and `formatter` slot for apps, inherited.
  378 +- `FormatterBase` is the minimum required.
  379 +- `FormatterLambda` provides for the easy addition of an arbitrary function.
  380 +- Added `help_all` support (not added by default).
381 381
382 Changes to the help system (most normal users will not notice this): 382 Changes to the help system (most normal users will not notice this):
383 383
384 -* Renamed `single_name` to `get_name(false, false)` (the default).  
385 -* The old `get_name()` is now `get_name(false, true)`.  
386 -* The old `get_pname()` is now `get_name(true, false)`.  
387 -* Removed `help_*` functions.  
388 -* Protected function `_has_help_positional` removed.  
389 -* `format_help` can now be chained.  
390 -* Added getters for the missing parts of options (help no longer uses any private parts).  
391 -* Help flags now use new `short_circuit` property to simplify parsing. [#121][] 384 +- Renamed `single_name` to `get_name(false, false)` (the default).
  385 +- The old `get_name()` is now `get_name(false, true)`.
  386 +- The old `get_pname()` is now `get_name(true, false)`.
  387 +- Removed `help_*` functions.
  388 +- Protected function `_has_help_positional` removed.
  389 +- `format_help` can now be chained.
  390 +- Added getters for the missing parts of options (help no longer uses any private parts).
  391 +- Help flags now use new `short_circuit` property to simplify parsing. [#121][]
392 392
393 New for Config file reading and writing [#121][]: 393 New for Config file reading and writing [#121][]:
394 394
395 -* Overridable, bidirectional Config.  
396 -* ConfigINI provided and used by default.  
397 -* Renamed ini to config in many places.  
398 -* Has `config_formatter()` and `get_config_formatter()`.  
399 -* Dropped prefix argument from `config_to_str`.  
400 -* Added `ConfigItem`.  
401 -* Added an example of a custom config format using [nlohmann/json][]. [#138][] 395 +- Overridable, bidirectional Config.
  396 +- ConfigINI provided and used by default.
  397 +- Renamed ini to config in many places.
  398 +- Has `config_formatter()` and `get_config_formatter()`.
  399 +- Dropped prefix argument from `config_to_str`.
  400 +- Added `ConfigItem`.
  401 +- Added an example of a custom config format using [nlohmann/json][]. [#138][]
402 402
403 Validators are now much more powerful [#118][], all built in validators upgraded to the new form: 403 Validators are now much more powerful [#118][], all built in validators upgraded to the new form:
404 404
405 -* A subclass of `CLI::Validator` is now also accepted.  
406 -* They now can set the type name to things like `PATH` and `INT in [1-4]`.  
407 -* Validators can be combined with `&` and `|`.  
408 -* Old form simple validators are still accepted. 405 +- A subclass of `CLI::Validator` is now also accepted.
  406 +- They now can set the type name to things like `PATH` and `INT in [1-4]`.
  407 +- Validators can be combined with `&` and `|`.
  408 +- Old form simple validators are still accepted.
409 409
410 Other changes: 410 Other changes:
411 411
412 -* Fixing `parse(args)`'s `args` setting and ordering after parse. [#141][]  
413 -* Replaced `set_custom_option` with `type_name` and `type_size` instead of `set_custom_option`. Methods return `this`. [#136][]  
414 -* Dropped `set_` on Option's `type_name`, `default_str`, and `default_val`. [#136][]  
415 -* Removed `set_` from App's `failure_message`, `footer`, `callback`, and `name`. [#136][]  
416 -* Fixed support `N<-1` for `type_size`. [#140][]  
417 -* Added `->each()` to make adding custom callbacks easier. [#126][]  
418 -* Allow empty options `add_option("-n",{})` to be edited later with `each` [#142][]  
419 -* Added filter argument to `get_subcommands`, `get_options`; use empty filter `{}` to avoid filtering.  
420 -* Added `get_groups()` to get groups.  
421 -* Better support for manual options with `get_option`, `set_results`, and `empty`. [#119][]  
422 -* `lname` and `sname` have getters, added `const get_parent`. [#120][]  
423 -* Using `add_set` will now capture L-values for sets, allowing further modification. [#113][]  
424 -* Dropped duplicate way to run `get_type_name` (`get_typeval`).  
425 -* Removed `requires` in favor of `needs` (deprecated in last version). [#112][]  
426 -* Const added to argv. [#126][] 412 +- Fixing `parse(args)`'s `args` setting and ordering after parse. [#141][]
  413 +- Replaced `set_custom_option` with `type_name` and `type_size` instead of `set_custom_option`. Methods return `this`. [#136][]
  414 +- Dropped `set_` on Option's `type_name`, `default_str`, and `default_val`. [#136][]
  415 +- Removed `set_` from App's `failure_message`, `footer`, `callback`, and `name`. [#136][]
  416 +- Fixed support `N<-1` for `type_size`. [#140][]
  417 +- Added `->each()` to make adding custom callbacks easier. [#126][]
  418 +- Allow empty options `add_option("-n",{})` to be edited later with `each` [#142][]
  419 +- Added filter argument to `get_subcommands`, `get_options`; use empty filter `{}` to avoid filtering.
  420 +- Added `get_groups()` to get groups.
  421 +- Better support for manual options with `get_option`, `set_results`, and `empty`. [#119][]
  422 +- `lname` and `sname` have getters, added `const get_parent`. [#120][]
  423 +- Using `add_set` will now capture L-values for sets, allowing further modification. [#113][]
  424 +- Dropped duplicate way to run `get_type_name` (`get_typeval`).
  425 +- Removed `requires` in favor of `needs` (deprecated in last version). [#112][]
  426 +- Const added to argv. [#126][]
427 427
428 Backend and testing changes: 428 Backend and testing changes:
429 429
430 -* Internally, `type_name` is now a lambda function; for sets, this reads the set live. [#116][]  
431 -* Cleaner tests without `app.reset()` (and `reset` is now `clear`). [#141][]  
432 -* Better CMake policy handling. [#110][]  
433 -* Includes are properly sorted. [#120][]  
434 -* Testing (only) now uses submodules. [#111][] 430 +- Internally, `type_name` is now a lambda function; for sets, this reads the set live. [#116][]
  431 +- Cleaner tests without `app.reset()` (and `reset` is now `clear`). [#141][]
  432 +- Better CMake policy handling. [#110][]
  433 +- Includes are properly sorted. [#120][]
  434 +- Testing (only) now uses submodules. [#111][]
435 435
436 [#109]: https://github.com/CLIUtils/CLI11/pull/109 436 [#109]: https://github.com/CLIUtils/CLI11/pull/109
437 [#110]: https://github.com/CLIUtils/CLI11/pull/110 437 [#110]: https://github.com/CLIUtils/CLI11/pull/110
@@ -449,7 +449,6 @@ Backend and testing changes: @@ -449,7 +449,6 @@ Backend and testing changes:
449 [#140]: https://github.com/CLIUtils/CLI11/pull/140 449 [#140]: https://github.com/CLIUtils/CLI11/pull/140
450 [#141]: https://github.com/CLIUtils/CLI11/pull/141 450 [#141]: https://github.com/CLIUtils/CLI11/pull/141
451 [#142]: https://github.com/CLIUtils/CLI11/pull/142 451 [#142]: https://github.com/CLIUtils/CLI11/pull/142
452 -  
453 [nlohmann/json]: https://github.com/nlohmann/json 452 [nlohmann/json]: https://github.com/nlohmann/json
454 453
455 ### Version 1.6.1: Platform fixes 454 ### Version 1.6.1: Platform fixes
@@ -458,9 +457,9 @@ This version provides a few fixes for special cases, such as mixing with `Window @@ -458,9 +457,9 @@ This version provides a few fixes for special cases, such as mixing with `Window
458 for systems like Hunter. The one new feature is the ability to produce "branded" single file output for 457 for systems like Hunter. The one new feature is the ability to produce "branded" single file output for
459 providing custom namespaces or custom macro names. 458 providing custom namespaces or custom macro names.
460 459
461 -* Added fix and test for including Windows.h [#145][]  
462 -* No longer build single file by default if main project, supports systems stuck on Python 2.6 [#149][], [#151][]  
463 -* Branding support for single file output [#150][] 460 +- Added fix and test for including Windows.h [#145][]
  461 +- No longer build single file by default if main project, supports systems stuck on Python 2.6 [#149][], [#151][]
  462 +- Branding support for single file output [#150][]
464 463
465 [#145]: https://github.com/CLIUtils/CLI11/pull/145 464 [#145]: https://github.com/CLIUtils/CLI11/pull/145
466 [#149]: https://github.com/CLIUtils/CLI11/pull/149 465 [#149]: https://github.com/CLIUtils/CLI11/pull/149
@@ -471,17 +470,17 @@ providing custom namespaces or custom macro names. @@ -471,17 +470,17 @@ providing custom namespaces or custom macro names.
471 470
472 This version fixes some formatting bugs with help-all. It also adds fixes for several warnings, including an experimental optional error on Clang 7. Several smaller fixes. 471 This version fixes some formatting bugs with help-all. It also adds fixes for several warnings, including an experimental optional error on Clang 7. Several smaller fixes.
473 472
474 -* Fixed help-all formatting [#163][]  
475 - * Printing help-all on nested command now fixed (App)  
476 - * Missing space after help-all restored (Default formatter)  
477 - * More detail printed on help all (Default formatter)  
478 - * Help-all subcommands get indented with inner blank lines removed (Default formatter)  
479 - * `detail::find_and_replace` added to utilities  
480 -* Fixed CMake install as subproject with `CLI11_INSTALL` flag. [#156][]  
481 -* Fixed warning about local variable hiding class member with MSVC [#157][]  
482 -* Fixed compile error with default settings on Clang 7 and libc++ [#158][]  
483 -* Fixed special case of `--help` on subcommands (general fix planned for 1.7) [#168][]  
484 -* Removing an option with links [#179][] 473 +- Fixed help-all formatting [#163][]
  474 + - Printing help-all on nested command now fixed (App)
  475 + - Missing space after help-all restored (Default formatter)
  476 + - More detail printed on help all (Default formatter)
  477 + - Help-all subcommands get indented with inner blank lines removed (Default formatter)
  478 + - `detail::find_and_replace` added to utilities
  479 +- Fixed CMake install as subproject with `CLI11_INSTALL` flag. [#156][]
  480 +- Fixed warning about local variable hiding class member with MSVC [#157][]
  481 +- Fixed compile error with default settings on Clang 7 and libc++ [#158][]
  482 +- Fixed special case of `--help` on subcommands (general fix planned for 1.7) [#168][]
  483 +- Removing an option with links [#179][]
485 484
486 [#156]: https://github.com/CLIUtils/CLI11/issues/156 485 [#156]: https://github.com/CLIUtils/CLI11/issues/156
487 [#157]: https://github.com/CLIUtils/CLI11/issues/157 486 [#157]: https://github.com/CLIUtils/CLI11/issues/157
@@ -496,24 +495,24 @@ This version introduced support for optionals, along with clarification and exam @@ -496,24 +495,24 @@ This version introduced support for optionals, along with clarification and exam
496 495
497 Note: This is the final release with `requires`, please switch to `needs`. 496 Note: This is the final release with `requires`, please switch to `needs`.
498 497
499 -* Fix unlimited short options eating two values before checking for positionals when no space present [#90][]  
500 -* Symmetric exclude text when excluding options, exclude can be called multiple times [#64][]  
501 -* Support for `std::optional`, `std::experimental::optional`, and `boost::optional` added if `__has_include` is supported [#95][]  
502 -* All macros/CMake variables now start with `CLI11_` instead of just `CLI_` [#95][]  
503 -* The internal stream was not being cleared before use in some cases. Fixed. [#95][]  
504 -* Using an enum now requires explicit conversion overload [#97][]  
505 -* The separator `--` now is removed when it ends unlimited arguments [#100][] 498 +- Fix unlimited short options eating two values before checking for positionals when no space present [#90][]
  499 +- Symmetric exclude text when excluding options, exclude can be called multiple times [#64][]
  500 +- Support for `std::optional`, `std::experimental::optional`, and `boost::optional` added if `__has_include` is supported [#95][]
  501 +- All macros/CMake variables now start with `CLI11_` instead of just `CLI_` [#95][]
  502 +- The internal stream was not being cleared before use in some cases. Fixed. [#95][]
  503 +- Using an enum now requires explicit conversion overload [#97][]
  504 +- The separator `--` now is removed when it ends unlimited arguments [#100][]
506 505
507 Other, non-user facing changes: 506 Other, non-user facing changes:
508 507
509 -* Added `Macros.hpp` with better C++ mode discovery [#95][]  
510 -* Deprecated macros added for all platforms  
511 -* C++17 is now tested on supported platforms [#95][]  
512 -* Informational printout now added to CTest [#95][]  
513 -* Better single file generation [#95][]  
514 -* Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest)  
515 -* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92][]  
516 -* Examples now run as part of testing [#99][] 508 +- Added `Macros.hpp` with better C++ mode discovery [#95][]
  509 +- Deprecated macros added for all platforms
  510 +- C++17 is now tested on supported platforms [#95][]
  511 +- Informational printout now added to CTest [#95][]
  512 +- Better single file generation [#95][]
  513 +- Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest)
  514 +- Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92][]
  515 +- Examples now run as part of testing [#99][]
517 516
518 [#64]: https://github.com/CLIUtils/CLI11/issues/64 517 [#64]: https://github.com/CLIUtils/CLI11/issues/64
519 [#90]: https://github.com/CLIUtils/CLI11/issues/90 518 [#90]: https://github.com/CLIUtils/CLI11/issues/90
@@ -527,13 +526,13 @@ Other, non-user facing changes: @@ -527,13 +526,13 @@ Other, non-user facing changes:
527 526
528 This patch release adds better access to the App programmatically, to assist with writing custom converters to other formats. It also improves the help output, and uses a new feature in CLI11 1.5 to fix an old "quirk" in the way unlimited options and positionals interact. 527 This patch release adds better access to the App programmatically, to assist with writing custom converters to other formats. It also improves the help output, and uses a new feature in CLI11 1.5 to fix an old "quirk" in the way unlimited options and positionals interact.
529 528
530 -* Make mixing unlimited positionals and options more intuitive [#102][]  
531 -* Add missing getters `get_options` and `get_description` to App [#105][]  
532 -* The app name now can be set, and will override the auto name if present [#105][]  
533 -* Add `(REQUIRED)` for required options [#104][]  
534 -* Print simple name for Needs/Excludes [#104][]  
535 -* Use Needs instead of Requires in help print [#104][]  
536 -* Groups now are listed in the original definition order [#106][] 529 +- Make mixing unlimited positionals and options more intuitive [#102][]
  530 +- Add missing getters `get_options` and `get_description` to App [#105][]
  531 +- The app name now can be set, and will override the auto name if present [#105][]
  532 +- Add `(REQUIRED)` for required options [#104][]
  533 +- Print simple name for Needs/Excludes [#104][]
  534 +- Use Needs instead of Requires in help print [#104][]
  535 +- Groups now are listed in the original definition order [#106][]
537 536
538 [#102]: https://github.com/CLIUtils/CLI11/issues/102 537 [#102]: https://github.com/CLIUtils/CLI11/issues/102
539 [#104]: https://github.com/CLIUtils/CLI11/pull/104 538 [#104]: https://github.com/CLIUtils/CLI11/pull/104
@@ -556,21 +555,20 @@ This version fixes the optional search in the single file version; some macros w @@ -556,21 +555,20 @@ This version fixes the optional search in the single file version; some macros w
556 555
557 This version adds lots of smaller fixes and additions after the refactor in version 1.3. More ways to download and use CLI11 in CMake have been added. INI files have improved support. 556 This version adds lots of smaller fixes and additions after the refactor in version 1.3. More ways to download and use CLI11 in CMake have been added. INI files have improved support.
558 557
559 -* Lexical cast is now more strict than before [#68][] and fails on overflow [#84][]  
560 -* Added `get_parent()` to access the parent from a subcommand  
561 -* Added `ExistingPath` validator [#73][]  
562 -* `app.allow_ini_extras()` added to allow extras in INI files [#70][]  
563 -* Multiline INI comments now supported  
564 -* Descriptions can now be written with `config_to_str` [#66][]  
565 -* Double printing of error message fixed [#77][]  
566 -* Renamed `requires` to `needs` to avoid C++20 keyword [#75][], [#82][]  
567 -* MakeSingleHeader now works if outside of git [#78][]  
568 -* Adding install support for CMake [#79][], improved support for `find_package` [#83][], [#84][]  
569 -* Added support for Conan.io [#83][] 558 +- Lexical cast is now more strict than before [#68][] and fails on overflow [#84][]
  559 +- Added `get_parent()` to access the parent from a subcommand
  560 +- Added `ExistingPath` validator [#73][]
  561 +- `app.allow_ini_extras()` added to allow extras in INI files [#70][]
  562 +- Multiline INI comments now supported
  563 +- Descriptions can now be written with `config_to_str` [#66][]
  564 +- Double printing of error message fixed [#77][]
  565 +- Renamed `requires` to `needs` to avoid C++20 keyword [#75][], [#82][]
  566 +- MakeSingleHeader now works if outside of git [#78][]
  567 +- Adding install support for CMake [#79][], improved support for `find_package` [#83][], [#84][]
  568 +- Added support for Conan.io [#83][]
570 569
571 [#70]: https://github.com/CLIUtils/CLI11/issues/70 570 [#70]: https://github.com/CLIUtils/CLI11/issues/70
572 [#75]: https://github.com/CLIUtils/CLI11/issues/75 571 [#75]: https://github.com/CLIUtils/CLI11/issues/75
573 -  
574 [#84]: https://github.com/CLIUtils/CLI11/pull/84 572 [#84]: https://github.com/CLIUtils/CLI11/pull/84
575 [#83]: https://github.com/CLIUtils/CLI11/pull/83 573 [#83]: https://github.com/CLIUtils/CLI11/pull/83
576 [#82]: https://github.com/CLIUtils/CLI11/pull/82 574 [#82]: https://github.com/CLIUtils/CLI11/pull/82
@@ -588,156 +586,156 @@ features only working on the main App have been addressed, and extra arguments h @@ -588,156 +586,156 @@ features only working on the main App have been addressed, and extra arguments h
588 of defaults makes configuring CLI11 much easier without having to subclass. Policies add new ways to handle multiple arguments to match your 586 of defaults makes configuring CLI11 much easier without having to subclass. Policies add new ways to handle multiple arguments to match your
589 favorite CLI programs. Error messages and help messages are better and more flexible. Several bugs and odd behaviors in the parser have been fixed. 587 favorite CLI programs. Error messages and help messages are better and more flexible. Several bugs and odd behaviors in the parser have been fixed.
590 588
591 -* Added a version macro, `CLI11_VERSION`, along with `*_MAJOR`, `*_MINOR`, and `*_PATCH`, for programmatic access to the version.  
592 -* Reworked the way defaults are set and inherited; explicit control given to user with `->option_defaults()` [#48](https://github.com/CLIUtils/CLI11/pull/48)  
593 -* Hidden options now are based on an empty group name, instead of special "hidden" keyword [#48](https://github.com/CLIUtils/CLI11/pull/48)  
594 -* `parse` no longer returns (so `CLI11_PARSE` is always usable) [#37](https://github.com/CLIUtils/CLI11/pull/37)  
595 -* Added `remaining()` and `remaining_size()` [#37](https://github.com/CLIUtils/CLI11/pull/37)  
596 -* `allow_extras` and `prefix_command` are now valid on subcommands [#37](https://github.com/CLIUtils/CLI11/pull/37)  
597 -* Added `take_last` to only take last value passed [#40](https://github.com/CLIUtils/CLI11/pull/40)  
598 -* Added `multi_option_policy` and shortcuts to provide more control than just a take last policy [#59](https://github.com/CLIUtils/CLI11/pull/59)  
599 -* More detailed error messages in a few cases [#41](https://github.com/CLIUtils/CLI11/pull/41)  
600 -* Footers can be added to help [#42](https://github.com/CLIUtils/CLI11/pull/42)  
601 -* Help flags are easier to customize [#43](https://github.com/CLIUtils/CLI11/pull/43)  
602 -* Subcommand now support groups [#46](https://github.com/CLIUtils/CLI11/pull/46)  
603 -* `CLI::RuntimeError` added, for easy exit with error codes [#45](https://github.com/CLIUtils/CLI11/pull/45)  
604 -* The clang-format script is now no longer "hidden" [#48](https://github.com/CLIUtils/CLI11/pull/48)  
605 -* The order is now preserved for subcommands (list and callbacks) [#49](https://github.com/CLIUtils/CLI11/pull/49)  
606 -* Tests now run individually, utilizing CMake 3.10 additions if possible [#50](https://github.com/CLIUtils/CLI11/pull/50)  
607 -* Failure messages are now customizable, with a shorter default [#52](https://github.com/CLIUtils/CLI11/pull/52)  
608 -* Some improvements to error codes [#53](https://github.com/CLIUtils/CLI11/pull/53)  
609 -* `require_subcommand` now offers a two-argument form and negative values on the one-argument form are more useful [#51](https://github.com/CLIUtils/CLI11/pull/51)  
610 -* Subcommands no longer match after the max required number is obtained [#51](https://github.com/CLIUtils/CLI11/pull/51)  
611 -* Unlimited options no longer prioritize over remaining/unlimited positionals [#51](https://github.com/CLIUtils/CLI11/pull/51)  
612 -* Added `->transform` which modifies the string parsed [#54](https://github.com/CLIUtils/CLI11/pull/54)  
613 -* Changed of API in validators to `void(std::string &)` (const for users), throwing providing nicer errors [#54](https://github.com/CLIUtils/CLI11/pull/54)  
614 -* Added `CLI::ArgumentMismatch` [#56](https://github.com/CLIUtils/CLI11/pull/56) and fixed missing failure if one arg expected [#55](https://github.com/CLIUtils/CLI11/issues/55)  
615 -* Support for minimum unlimited expected arguments [#56](https://github.com/CLIUtils/CLI11/pull/56)  
616 -* Single internal arg parse function [#56](https://github.com/CLIUtils/CLI11/pull/56)  
617 -* Allow options to be disabled from INI file, rename `add_config` to `set_config` [#60](https://github.com/CLIUtils/CLI11/pull/60) 589 +- Added a version macro, `CLI11_VERSION`, along with `*_MAJOR`, `*_MINOR`, and `*_PATCH`, for programmatic access to the version.
  590 +- Reworked the way defaults are set and inherited; explicit control given to user with `->option_defaults()` [#48](https://github.com/CLIUtils/CLI11/pull/48)
  591 +- Hidden options now are based on an empty group name, instead of special "hidden" keyword [#48](https://github.com/CLIUtils/CLI11/pull/48)
  592 +- `parse` no longer returns (so `CLI11_PARSE` is always usable) [#37](https://github.com/CLIUtils/CLI11/pull/37)
  593 +- Added `remaining()` and `remaining_size()` [#37](https://github.com/CLIUtils/CLI11/pull/37)
  594 +- `allow_extras` and `prefix_command` are now valid on subcommands [#37](https://github.com/CLIUtils/CLI11/pull/37)
  595 +- Added `take_last` to only take last value passed [#40](https://github.com/CLIUtils/CLI11/pull/40)
  596 +- Added `multi_option_policy` and shortcuts to provide more control than just a take last policy [#59](https://github.com/CLIUtils/CLI11/pull/59)
  597 +- More detailed error messages in a few cases [#41](https://github.com/CLIUtils/CLI11/pull/41)
  598 +- Footers can be added to help [#42](https://github.com/CLIUtils/CLI11/pull/42)
  599 +- Help flags are easier to customize [#43](https://github.com/CLIUtils/CLI11/pull/43)
  600 +- Subcommand now support groups [#46](https://github.com/CLIUtils/CLI11/pull/46)
  601 +- `CLI::RuntimeError` added, for easy exit with error codes [#45](https://github.com/CLIUtils/CLI11/pull/45)
  602 +- The clang-format script is now no longer "hidden" [#48](https://github.com/CLIUtils/CLI11/pull/48)
  603 +- The order is now preserved for subcommands (list and callbacks) [#49](https://github.com/CLIUtils/CLI11/pull/49)
  604 +- Tests now run individually, utilizing CMake 3.10 additions if possible [#50](https://github.com/CLIUtils/CLI11/pull/50)
  605 +- Failure messages are now customizable, with a shorter default [#52](https://github.com/CLIUtils/CLI11/pull/52)
  606 +- Some improvements to error codes [#53](https://github.com/CLIUtils/CLI11/pull/53)
  607 +- `require_subcommand` now offers a two-argument form and negative values on the one-argument form are more useful [#51](https://github.com/CLIUtils/CLI11/pull/51)
  608 +- Subcommands no longer match after the max required number is obtained [#51](https://github.com/CLIUtils/CLI11/pull/51)
  609 +- Unlimited options no longer prioritize over remaining/unlimited positionals [#51](https://github.com/CLIUtils/CLI11/pull/51)
  610 +- Added `->transform` which modifies the string parsed [#54](https://github.com/CLIUtils/CLI11/pull/54)
  611 +- Changed of API in validators to `void(std::string &)` (const for users), throwing providing nicer errors [#54](https://github.com/CLIUtils/CLI11/pull/54)
  612 +- Added `CLI::ArgumentMismatch` [#56](https://github.com/CLIUtils/CLI11/pull/56) and fixed missing failure if one arg expected [#55](https://github.com/CLIUtils/CLI11/issues/55)
  613 +- Support for minimum unlimited expected arguments [#56](https://github.com/CLIUtils/CLI11/pull/56)
  614 +- Single internal arg parse function [#56](https://github.com/CLIUtils/CLI11/pull/56)
  615 +- Allow options to be disabled from INI file, rename `add_config` to `set_config` [#60](https://github.com/CLIUtils/CLI11/pull/60)
618 616
619 > ### Converting from CLI11 1.2 617 > ### Converting from CLI11 1.2
620 > 618 >
621 -> * `app.parse` no longer returns a vector. Instead, use `app.remaining(true)`.  
622 -> * `"hidden"` is no longer a special group name, instead use `""`  
623 -> * Validators API has changed to return an error string; use `.empty()` to get the old bool back  
624 -> * Use `.set_help_flag` instead of accessing the help pointer directly (discouraged, but not removed yet)  
625 -> * `add_config` has been renamed to `set_config`  
626 -> * Errors thrown in some cases are slightly more specific 619 +> - `app.parse` no longer returns a vector. Instead, use `app.remaining(true)`.
  620 +> - `"hidden"` is no longer a special group name, instead use `""`
  621 +> - Validators API has changed to return an error string; use `.empty()` to get the old bool back
  622 +> - Use `.set_help_flag` instead of accessing the help pointer directly (discouraged, but not removed yet)
  623 +> - `add_config` has been renamed to `set_config`
  624 +> - Errors thrown in some cases are slightly more specific
627 625
628 ## Version 1.2: Stability 626 ## Version 1.2: Stability
629 627
630 This release focuses on making CLI11 behave properly in corner cases, and with config files on the command line. This includes fixes for a variety of reported issues. A few features were added to make life easier, as well; such as a new flag callback and a macro for the parse command. 628 This release focuses on making CLI11 behave properly in corner cases, and with config files on the command line. This includes fixes for a variety of reported issues. A few features were added to make life easier, as well; such as a new flag callback and a macro for the parse command.
631 629
632 -* Added functional form of flag [#33](https://github.com/CLIUtils/CLI11/pull/33), automatic on C++14  
633 -* Fixed Config file search if passed on command line [#30](https://github.com/CLIUtils/CLI11/issues/30)  
634 -* Added `CLI11_PARSE(app, argc, argv)` macro for simple parse commands (does not support returning arg)  
635 -* The name string can now contain spaces around commas [#29](https://github.com/CLIUtils/CLI11/pull/29)  
636 -* `set_default_str` now only sets string, and `set_default_val` will evaluate the default string given [#26](https://github.com/CLIUtils/CLI11/issues/26)  
637 -* Required positionals now take priority over subcommands [#23](https://github.com/CLIUtils/CLI11/issues/23)  
638 -* Extra requirements enforced by Travis 630 +- Added functional form of flag [#33](https://github.com/CLIUtils/CLI11/pull/33), automatic on C++14
  631 +- Fixed Config file search if passed on command line [#30](https://github.com/CLIUtils/CLI11/issues/30)
  632 +- Added `CLI11_PARSE(app, argc, argv)` macro for simple parse commands (does not support returning arg)
  633 +- The name string can now contain spaces around commas [#29](https://github.com/CLIUtils/CLI11/pull/29)
  634 +- `set_default_str` now only sets string, and `set_default_val` will evaluate the default string given [#26](https://github.com/CLIUtils/CLI11/issues/26)
  635 +- Required positionals now take priority over subcommands [#23](https://github.com/CLIUtils/CLI11/issues/23)
  636 +- Extra requirements enforced by Travis
639 637
640 ## Version 1.1: Feedback 638 ## Version 1.1: Feedback
641 639
642 This release incorporates feedback from the release announcement. The examples are slowly being expanded, some corner cases improved, and some new functionality for tricky parsing situations. 640 This release incorporates feedback from the release announcement. The examples are slowly being expanded, some corner cases improved, and some new functionality for tricky parsing situations.
643 641
644 -* Added simple support for enumerations, allow non-printable objects [#12](https://github.com/CLIUtils/CLI11/issues/12)  
645 -* Added `app.parse_order()` with original parse order ([#13](https://github.com/CLIUtils/CLI11/issues/13), [#16](https://github.com/CLIUtils/CLI11/pull/16))  
646 -* Added `prefix_command()`, which is like `allow_extras` but instantly stops and returns. ([#8](https://github.com/CLIUtils/CLI11/issues/8), [#17](https://github.com/CLIUtils/CLI11/pull/17))  
647 -* Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10), [#20](https://github.com/CLIUtils/CLI11/pull/20))  
648 -* Some improvements to CMake, detect Python and no dependencies on Python 2 (like Python 3) ([#18](https://github.com/CLIUtils/CLI11/issues/18), [#21](https://github.com/CLIUtils/CLI11/pull/21)) 642 +- Added simple support for enumerations, allow non-printable objects [#12](https://github.com/CLIUtils/CLI11/issues/12)
  643 +- Added `app.parse_order()` with original parse order ([#13](https://github.com/CLIUtils/CLI11/issues/13), [#16](https://github.com/CLIUtils/CLI11/pull/16))
  644 +- Added `prefix_command()`, which is like `allow_extras` but instantly stops and returns. ([#8](https://github.com/CLIUtils/CLI11/issues/8), [#17](https://github.com/CLIUtils/CLI11/pull/17))
  645 +- Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10), [#20](https://github.com/CLIUtils/CLI11/pull/20))
  646 +- Some improvements to CMake, detect Python and no dependencies on Python 2 (like Python 3) ([#18](https://github.com/CLIUtils/CLI11/issues/18), [#21](https://github.com/CLIUtils/CLI11/pull/21))
649 647
650 ## Version 1.0: Official release 648 ## Version 1.0: Official release
651 649
652 This is the first stable release for CLI11. Future releases will try to remain backward compatible and will follow semantic versioning if possible. There were a few small changes since version 0.9: 650 This is the first stable release for CLI11. Future releases will try to remain backward compatible and will follow semantic versioning if possible. There were a few small changes since version 0.9:
653 651
654 -* Cleanup using `clang-tidy` and `clang-format`  
655 -* Small improvements to Timers, easier to subclass Error  
656 -* Move to 3-Clause BSD license 652 +- Cleanup using `clang-tidy` and `clang-format`
  653 +- Small improvements to Timers, easier to subclass Error
  654 +- Move to 3-Clause BSD license
657 655
658 ## Version 0.9: Polish 656 ## Version 0.9: Polish
659 657
660 This release focused on cleaning up the most exotic compiler warnings, fixing a few oddities of the config parser, and added a more natural method to check subcommands. 658 This release focused on cleaning up the most exotic compiler warnings, fixing a few oddities of the config parser, and added a more natural method to check subcommands.
661 659
662 -* Better CMake named target (CLI11)  
663 -* More warnings added, fixed  
664 -* Ini output now includes `=false` when `default_also` is true  
665 -* Ini no longer lists the help pointer  
666 -* Added test for inclusion in multiple files and linking, fixed issues (rarely needed for CLI, but nice for tools)  
667 -* Support for complex numbers  
668 -* Subcommands now test true/false directly or with `->parsed()`, cleaner parse 660 +- Better CMake named target (CLI11)
  661 +- More warnings added, fixed
  662 +- Ini output now includes `=false` when `default_also` is true
  663 +- Ini no longer lists the help pointer
  664 +- Added test for inclusion in multiple files and linking, fixed issues (rarely needed for CLI, but nice for tools)
  665 +- Support for complex numbers
  666 +- Subcommands now test true/false directly or with `->parsed()`, cleaner parse
669 667
670 ## Version 0.8: CLIUtils 668 ## Version 0.8: CLIUtils
671 669
672 This release moved the repository to the CLIUtils main organization. 670 This release moved the repository to the CLIUtils main organization.
673 671
674 -* Moved to CLIUtils on GitHub  
675 -* Fixed docs build and a few links 672 +- Moved to CLIUtils on GitHub
  673 +- Fixed docs build and a few links
676 674
677 ## Version 0.7: Code coverage 100% 675 ## Version 0.7: Code coverage 100%
678 676
679 Lots of small bugs fixed when adding code coverage, better in edge cases. Much more powerful ini support. 677 Lots of small bugs fixed when adding code coverage, better in edge cases. Much more powerful ini support.
680 678
681 -* Allow comments in ini files (lines starting with `;`)  
682 -* Ini files support flags, vectors, subcommands  
683 -* Added CodeCov code coverage reports  
684 -* Lots of small bugfixes related to adding tests to increase coverage to 100%  
685 -* Error handling now uses scoped enum in errors  
686 -* Reparsing rules changed a little to accommodate Ini files. Callbacks are now called when parsing INI, and reset any time results are added.  
687 -* Adding extra utilities in full version only, `Timer` (not needed for parsing, but useful for general CLI applications).  
688 -* Better support for custom `add_options` like functions. 679 +- Allow comments in ini files (lines starting with `;`)
  680 +- Ini files support flags, vectors, subcommands
  681 +- Added CodeCov code coverage reports
  682 +- Lots of small bugfixes related to adding tests to increase coverage to 100%
  683 +- Error handling now uses scoped enum in errors
  684 +- Reparsing rules changed a little to accommodate Ini files. Callbacks are now called when parsing INI, and reset any time results are added.
  685 +- Adding extra utilities in full version only, `Timer` (not needed for parsing, but useful for general CLI applications).
  686 +- Better support for custom `add_options` like functions.
689 687
690 ## Version 0.6: Cleanup 688 ## Version 0.6: Cleanup
691 689
692 Lots of cleanup and docs additions made it into this release. Parsing is simpler and more robust; fall through option added and works as expected; much more consistent variable names internally. 690 Lots of cleanup and docs additions made it into this release. Parsing is simpler and more robust; fall through option added and works as expected; much more consistent variable names internally.
693 691
694 -* Simplified parsing to use `vector<string>` only  
695 -* Fixed fallthrough, made it optional as well (default: off): `.fallthrough()`.  
696 -* Added string versions of `->requires()` and `->excludes()` for consistency.  
697 -* Renamed protected members for internal consistency, grouped docs.  
698 -* Added the ability to add a number to `.require_subcommand()`. 692 +- Simplified parsing to use `vector<string>` only
  693 +- Fixed fallthrough, made it optional as well (default: off): `.fallthrough()`.
  694 +- Added string versions of `->requires()` and `->excludes()` for consistency.
  695 +- Renamed protected members for internal consistency, grouped docs.
  696 +- Added the ability to add a number to `.require_subcommand()`.
699 697
700 ## Version 0.5: Windows support 698 ## Version 0.5: Windows support
701 699
702 -* Allow `Hidden` options.  
703 -* Throw `OptionAlreadyAdded` errors for matching subcommands or options, with ignore-case included, tests  
704 -* `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. Subcommands inherit setting from parent App on creation.  
705 -* Subcommands now can be "chained", that is, left over arguments can now include subcommands that then get parsed. Subcommands are now a list (`get_subcommands`). Added `got_subcommand(App_or_name)` to check for subcommands.  
706 -* Added `.allow_extras()` to disable error on failure. Parse returns a vector of leftover options. Renamed error to `ExtrasError`, and now triggers on extra options too.  
707 -* Added `require_subcommand` to `App`, to simplify forcing subcommands. Do **not** do `add_subcommand()->require_subcommand`, since that is the subcommand, not the main `App`.  
708 -* Added printout of ini file text given parsed options, skips flags.  
709 -* Support for quotes and spaces in ini files  
710 -* Fixes to allow support for Windows (added Appveyor) (Uses `-`, not `/` syntax) 700 +- Allow `Hidden` options.
  701 +- Throw `OptionAlreadyAdded` errors for matching subcommands or options, with ignore-case included, tests
  702 +- `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. Subcommands inherit setting from parent App on creation.
  703 +- Subcommands now can be "chained", that is, left over arguments can now include subcommands that then get parsed. Subcommands are now a list (`get_subcommands`). Added `got_subcommand(App_or_name)` to check for subcommands.
  704 +- Added `.allow_extras()` to disable error on failure. Parse returns a vector of leftover options. Renamed error to `ExtrasError`, and now triggers on extra options too.
  705 +- Added `require_subcommand` to `App`, to simplify forcing subcommands. Do **not** do `add_subcommand()->require_subcommand`, since that is the subcommand, not the main `App`.
  706 +- Added printout of ini file text given parsed options, skips flags.
  707 +- Support for quotes and spaces in ini files
  708 +- Fixes to allow support for Windows (added Appveyor) (Uses `-`, not `/` syntax)
711 709
712 ## Version 0.4: Ini support 710 ## Version 0.4: Ini support
713 711
714 -* Updates to help print  
715 -* Removed `run`, please use `parse` unless you subclass and add it  
716 -* Supports ini files mixed with command line, tested  
717 -* Added Range for further Plumbum compatibility  
718 -* Added function to print out ini file 712 +- Updates to help print
  713 +- Removed `run`, please use `parse` unless you subclass and add it
  714 +- Supports ini files mixed with command line, tested
  715 +- Added Range for further Plumbum compatibility
  716 +- Added function to print out ini file
719 717
720 ## Version 0.3: Plumbum compatibility 718 ## Version 0.3: Plumbum compatibility
721 719
722 -* Added `->requires`, `->excludes`, and `->envname` from [Plumbum](http://plumbum.readthedocs.io/en/latest/)  
723 -* Supports `->mandatory` from Plumbum  
724 -* More tests for help strings, improvements in formatting  
725 -* Support type and set syntax in positionals help strings  
726 -* Added help groups, with `->group("name")` syntax  
727 -* Added initial support for ini file reading with `add_config` option.  
728 -* Supports GCC 4.7 again  
729 -* Clang 3.5 now required for tests due to googlemock usage, 3.4 should still work otherwise  
730 -* Changes `setup` for an explicit help bool in constructor/`add_subcommand` 720 +- Added `->requires`, `->excludes`, and `->envname` from [Plumbum](http://plumbum.readthedocs.io/en/latest/)
  721 +- Supports `->mandatory` from Plumbum
  722 +- More tests for help strings, improvements in formatting
  723 +- Support type and set syntax in positionals help strings
  724 +- Added help groups, with `->group("name")` syntax
  725 +- Added initial support for ini file reading with `add_config` option.
  726 +- Supports GCC 4.7 again
  727 +- Clang 3.5 now required for tests due to googlemock usage, 3.4 should still work otherwise
  728 +- Changes `setup` for an explicit help bool in constructor/`add_subcommand`
731 729
732 ## Version 0.2: Leaner and meaner 730 ## Version 0.2: Leaner and meaner
733 731
734 -* Moved to simpler syntax, where `Option` pointers are returned and operated on  
735 -* Removed `make_` style options  
736 -* Simplified Validators, now only requires `->check(function)`  
737 -* Removed Combiners  
738 -* Fixed pointers to Options, stored in `unique_ptr` now  
739 -* Added `Option_p` and `App_p`, mostly for internal use  
740 -* Startup sequence, including help flag, can be modified by subclasses 732 +- Moved to simpler syntax, where `Option` pointers are returned and operated on
  733 +- Removed `make_` style options
  734 +- Simplified Validators, now only requires `->check(function)`
  735 +- Removed Combiners
  736 +- Fixed pointers to Options, stored in `unique_ptr` now
  737 +- Added `Option_p` and `App_p`, mostly for internal use
  738 +- Startup sequence, including help flag, can be modified by subclasses
741 739
742 ## Version 0.1: First release 740 ## Version 0.1: First release
743 741
README.md
@@ -25,38 +25,38 @@ CLI11 is a command line parser for C++11 and beyond that provides a rich feature @@ -25,38 +25,38 @@ CLI11 is a command line parser for C++11 and beyond that provides a rich feature
25 25
26 ## Table of Contents 26 ## Table of Contents
27 27
28 -* [Background](#background)  
29 - * [Introduction](#introduction)  
30 - * [Why write another CLI parser?](#why-write-another-cli-parser)  
31 - * [Other parsers](#other-parsers)  
32 - * [Features not supported by this library](#features-not-supported-by-this-library)  
33 -* [Install](#install)  
34 -* [Usage](#usage)  
35 - * [Adding options](#adding-options)  
36 - * [Option types](#option-types)  
37 - * [Example](#example)  
38 - * [Option options](#option-options)  
39 - * [Validators](#validators)  
40 - * [Transforming Validators](#transforming-validators)  
41 - * [Validator operations](#validator-operations)  
42 - * [Custom Validators](#custom-validators)  
43 - * [Querying Validators](#querying-validators)  
44 - * [Getting Results](#getting-results)  
45 - * [Subcommands](#subcommands)  
46 - * [Subcommand options](#subcommand-options)  
47 - * [Option groups](#option-groups)  
48 - * [Callbacks](#callbacks)  
49 - * [Configuration file](#configuration-file)  
50 - * [Inheriting defaults](#inheriting-defaults)  
51 - * [Formatting](#formatting)  
52 - * [Subclassing](#subclassing)  
53 - * [How it works](#how-it-works)  
54 - * [Utilities](#utilities)  
55 - * [Other libraries](#other-libraries)  
56 -* [API](#api)  
57 -* [Examples](#Examples)  
58 -* [Contribute](#contribute)  
59 -* [License](#license) 28 +- [Background](#background)
  29 + - [Introduction](#introduction)
  30 + - [Why write another CLI parser?](#why-write-another-cli-parser)
  31 + - [Other parsers](#other-parsers)
  32 + - [Features not supported by this library](#features-not-supported-by-this-library)
  33 +- [Install](#install)
  34 +- [Usage](#usage)
  35 + - [Adding options](#adding-options)
  36 + - [Option types](#option-types)
  37 + - [Example](#example)
  38 + - [Option options](#option-options)
  39 + - [Validators](#validators)
  40 + - [Transforming Validators](#transforming-validators)
  41 + - [Validator operations](#validator-operations)
  42 + - [Custom Validators](#custom-validators)
  43 + - [Querying Validators](#querying-validators)
  44 + - [Getting Results](#getting-results)
  45 + - [Subcommands](#subcommands)
  46 + - [Subcommand options](#subcommand-options)
  47 + - [Option groups](#option-groups)
  48 + - [Callbacks](#callbacks)
  49 + - [Configuration file](#configuration-file)
  50 + - [Inheriting defaults](#inheriting-defaults)
  51 + - [Formatting](#formatting)
  52 + - [Subclassing](#subclassing)
  53 + - [How it works](#how-it-works)
  54 + - [Utilities](#utilities)
  55 + - [Other libraries](#other-libraries)
  56 +- [API](#api)
  57 +- [Examples](#Examples)
  58 +- [Contribute](#contribute)
  59 +- [License](#license)
60 60
61 Features that were added in the last released minor version are marked with "๐Ÿ†•". Features only available in main are marked with "๐Ÿšง". 61 Features that were added in the last released minor version are marked with "๐Ÿ†•". Features only available in main are marked with "๐Ÿšง".
62 62
@@ -74,21 +74,21 @@ You can be notified when new releases are made by subscribing to &lt;https://github @@ -74,21 +74,21 @@ You can be notified when new releases are made by subscribing to &lt;https://github
74 74
75 An acceptable CLI parser library should be all of the following: 75 An acceptable CLI parser library should be all of the following:
76 76
77 -* Easy to include (i.e., header only, one file if possible, **no external requirements**).  
78 -* Short, simple syntax: This is one of the main reasons to use a CLI parser, it should make variables from the command line nearly as easy to define as any other variables. If most of your program is hidden in CLI parsing, this is a problem for readability.  
79 -* C++11 or better: Should work with GCC 4.8+ (default on CentOS/RHEL 7), Clang 3.4+, AppleClang 7+, NVCC 7.0+, or MSVC 2015+.  
80 -* Work on Linux, macOS, and Windows.  
81 -* Well tested on all common platforms and compilers. "Well" is defined as having good coverage measured by [CodeCov][].  
82 -* Clear help printing.  
83 -* Nice error messages.  
84 -* Standard shell idioms supported naturally, like grouping flags, a positional separator, etc.  
85 -* Easy to execute, with help, parse errors, etc. providing correct exit and details.  
86 -* Easy to extend as part of a framework that provides "applications" to users.  
87 -* Usable subcommand syntax, with support for multiple subcommands, nested subcommands, option groups, and optional fallthrough (explained later).  
88 -* Ability to add a configuration file (`TOML`, `INI`, or custom format), and produce it as well.  
89 -* Produce real values that can be used directly in code, not something you have pay compute time to look up, for HPC applications.  
90 -* Work with common types, simple custom types, and extensible to exotic types.  
91 -* Permissively licensed. 77 +- Easy to include (i.e., header only, one file if possible, **no external requirements**).
  78 +- Short, simple syntax: This is one of the main reasons to use a CLI parser, it should make variables from the command line nearly as easy to define as any other variables. If most of your program is hidden in CLI parsing, this is a problem for readability.
  79 +- C++11 or better: Should work with GCC 4.8+ (default on CentOS/RHEL 7), Clang 3.4+, AppleClang 7+, NVCC 7.0+, or MSVC 2015+.
  80 +- Work on Linux, macOS, and Windows.
  81 +- Well tested on all common platforms and compilers. "Well" is defined as having good coverage measured by [CodeCov][].
  82 +- Clear help printing.
  83 +- Nice error messages.
  84 +- Standard shell idioms supported naturally, like grouping flags, a positional separator, etc.
  85 +- Easy to execute, with help, parse errors, etc. providing correct exit and details.
  86 +- Easy to extend as part of a framework that provides "applications" to users.
  87 +- Usable subcommand syntax, with support for multiple subcommands, nested subcommands, option groups, and optional fallthrough (explained later).
  88 +- Ability to add a configuration file (`TOML`, `INI`, or custom format), and produce it as well.
  89 +- Produce real values that can be used directly in code, not something you have pay compute time to look up, for HPC applications.
  90 +- Work with common types, simple custom types, and extensible to exotic types.
  91 +- Permissively licensed.
92 92
93 ### Other parsers 93 ### Other parsers
94 94
@@ -110,12 +110,12 @@ After I wrote this, I also found the following libraries: @@ -110,12 +110,12 @@ After I wrote this, I also found the following libraries:
110 | [GetOpt][] | Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors). | 110 | [GetOpt][] | Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors). |
111 | [ProgramOptions.hxx][] | Interesting library, less powerful and no subcommands. Nice callback system. | 111 | [ProgramOptions.hxx][] | Interesting library, less powerful and no subcommands. Nice callback system. |
112 | [Args][] | Also interesting, and supports subcommands. I like the optional-like design, but CLI11 is cleaner and provides direct value access, and is less verbose. | 112 | [Args][] | Also interesting, and supports subcommands. I like the optional-like design, but CLI11 is cleaner and provides direct value access, and is less verbose. |
113 -| [Argument Aggregator][] | I'm a big fan of the [fmt][] library, and the try-catch statement looks familiar. :thumbsup: Doesn't seem to support subcommands. | 113 +| [Argument Aggregator][] | I'm a big fan of the [fmt][] library, and the try-catch statement looks familiar. :thumbsup: Doesn't seem to support subcommands. |
114 | [Clara][] | Simple library built for the excellent [Catch][] testing framework. Unique syntax, limited scope. | 114 | [Clara][] | Simple library built for the excellent [Catch][] testing framework. Unique syntax, limited scope. |
115 | [Argh!][] | Very minimalistic C++11 parser, single header. Don't have many features. No help generation?!?! At least it's exception-free. | 115 | [Argh!][] | Very minimalistic C++11 parser, single header. Don't have many features. No help generation?!?! At least it's exception-free. |
116 | [CLI][] | Custom language and parser. Huge build-system overkill for very little benefit. Last release in 2009, but still occasionally active. | 116 | [CLI][] | Custom language and parser. Huge build-system overkill for very little benefit. Last release in 2009, but still occasionally active. |
117 | [argparse][] | C++17 single file argument parser. Design seems similar to CLI11 in some ways. The author has several other interesting projects. | 117 | [argparse][] | C++17 single file argument parser. Design seems similar to CLI11 in some ways. The author has several other interesting projects. |
118 -| [lyra][] | a simple header only parser with composable options. Might work well for simple standardized parsing | 118 +| [lyra][] | a simple header only parser with composable options. Might work well for simple standardized parsing |
119 119
120 See [Awesome C++][] for a less-biased list of parsers. You can also find other single file libraries at [Single file libs][]. 120 See [Awesome C++][] for a less-biased list of parsers. You can also find other single file libraries at [Single file libs][].
121 121
@@ -129,19 +129,19 @@ So, this library was designed to provide a great syntax, good compiler compatibi @@ -129,19 +129,19 @@ So, this library was designed to provide a great syntax, good compiler compatibi
129 129
130 There are some other possible "features" that are intentionally not supported by this library: 130 There are some other possible "features" that are intentionally not supported by this library:
131 131
132 -* Non-standard variations on syntax, like `-long` options. This is non-standard and should be avoided, so that is enforced by this library.  
133 -* Completion of partial options, such as Python's `argparse` supplies for incomplete arguments. It's better not to guess. Most third party command line parsers for python actually reimplement command line parsing rather than using argparse because of this perceived design flaw (recent versions do have an option to disable it).  
134 -* Autocomplete: This might eventually be added to both Plumbum and CLI11, but it is not supported yet.  
135 -* Wide strings / unicode: Since this uses the standard library only, it might be hard to properly implement, but I would be open to suggestions in how to do this. 132 +- Non-standard variations on syntax, like `-long` options. This is non-standard and should be avoided, so that is enforced by this library.
  133 +- Completion of partial options, such as Python's `argparse` supplies for incomplete arguments. It's better not to guess. Most third party command line parsers for python actually reimplement command line parsing rather than using argparse because of this perceived design flaw (recent versions do have an option to disable it).
  134 +- Autocomplete: This might eventually be added to both Plumbum and CLI11, but it is not supported yet.
  135 +- Wide strings / unicode: Since this uses the standard library only, it might be hard to properly implement, but I would be open to suggestions in how to do this.
136 136
137 ## Install 137 ## Install
138 138
139 To use, there are several methods: 139 To use, there are several methods:
140 140
141 -* All-in-one local header: Copy `CLI11.hpp` from the [most recent release][github releases] into your include directory, and you are set. This is combined from the source files for every release. This includes the entire command parser library, but does not include separate utilities (like `Timer`, `AutoTimer`). The utilities are completely self contained and can be copied separately.  
142 -* All-in-one global header: Like above, but copying the file to a shared folder location like `/opt/CLI11`. Then, the C++ include path has to be extended to point at this folder. With CMake, use `include_directories(/opt/CLI11)`  
143 -* Local headers and target: Use `CLI/*.hpp` files. You could check out the repository as a git submodule, for example. With CMake, you can use `add_subdirectory` and the `CLI11::CLI11` interface target when linking. If not using a submodule, you must ensure that the copied files are located inside the same tree directory than your current project, to prevent an error with CMake and `add_subdirectory`.  
144 -* Global headers: Use `CLI/*.hpp` files stored in a shared folder. You could check out the git repository to a system-wide folder, for example `/opt/`. With CMake, you could add to the include path via: 141 +- All-in-one local header: Copy `CLI11.hpp` from the [most recent release][github releases] into your include directory, and you are set. This is combined from the source files for every release. This includes the entire command parser library, but does not include separate utilities (like `Timer`, `AutoTimer`). The utilities are completely self contained and can be copied separately.
  142 +- All-in-one global header: Like above, but copying the file to a shared folder location like `/opt/CLI11`. Then, the C++ include path has to be extended to point at this folder. With CMake, use `include_directories(/opt/CLI11)`
  143 +- Local headers and target: Use `CLI/*.hpp` files. You could check out the repository as a git submodule, for example. With CMake, you can use `add_subdirectory` and the `CLI11::CLI11` interface target when linking. If not using a submodule, you must ensure that the copied files are located inside the same tree directory than your current project, to prevent an error with CMake and `add_subdirectory`.
  144 +- Global headers: Use `CLI/*.hpp` files stored in a shared folder. You could check out the git repository to a system-wide folder, for example `/opt/`. With CMake, you could add to the include path via:
145 145
146 ```bash 146 ```bash
147 if(NOT DEFINED CLI11_DIR) 147 if(NOT DEFINED CLI11_DIR)
@@ -158,10 +158,10 @@ And then in the source code (adding several headers might be needed to prevent l @@ -158,10 +158,10 @@ And then in the source code (adding several headers might be needed to prevent l
158 #include "CLI/Config.hpp" 158 #include "CLI/Config.hpp"
159 ``` 159 ```
160 160
161 -* Global headers and target: configuring and installing the project is required for linking CLI11 to your project in the same way as you would do with any other external library. With CMake, this step allows using `find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a specific folder like `/opt/CLI11`, then you have to pass `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use [Conan.io][conan-link] or [Hunter][].  
162 - (These are just conveniences to allow you to use your favorite method of managing packages; it's just header only so including the correct path and  
163 - using C++11 is all you really need.)  
164 -* Via FetchContent in CMake 3.14+ (or 3.11+ with more work): you can add this with fetch-content, then use the `CLI11::CLI11` target as above, and CMake will download the project in the configure stage: 161 +- Global headers and target: configuring and installing the project is required for linking CLI11 to your project in the same way as you would do with any other external library. With CMake, this step allows using `find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a specific folder like `/opt/CLI11`, then you have to pass `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use [Conan.io][conan-link] or [Hunter][].
  162 + (These are just conveniences to allow you to use your favorite method of managing packages; it's just header only so including the correct path and
  163 + using C++11 is all you really need.)
  164 +- Via FetchContent in CMake 3.14+ (or 3.11+ with more work): you can add this with fetch-content, then use the `CLI11::CLI11` target as above, and CMake will download the project in the configure stage:
165 165
166 ```cmake 166 ```cmake
167 include(FetchContent) 167 include(FetchContent)
@@ -186,15 +186,15 @@ CTEST_OUTPUT_ON_FAILURE=1 cmake --build build -t test @@ -186,15 +186,15 @@ CTEST_OUTPUT_ON_FAILURE=1 cmake --build build -t test
186 186
187 <details><summary>Note: Special instructions for GCC 8</summary><p> 187 <details><summary>Note: Special instructions for GCC 8</summary><p>
188 188
189 -If you are using GCC 8 and using it in C++17 mode with CLI11. CLI11 makes use of the `<filesystem>` header if available, but specifically for this compiler, the `filesystem` library is separate from the standard library and needs to be linked separately. So it is available but CLI11 doesn't use it by default. 189 +If you are using GCC 8 and using it in C++17 mode with CLI11. CLI11 makes use of the `<filesystem>` header if available, but specifically for this compiler, the `filesystem` library is separate from the standard library and needs to be linked separately. So it is available but CLI11 doesn't use it by default.
190 190
191 -Specifically `libstdc++fs` needs to be added to the linking list and `CLI11_HAS_FILESYSTEM=1` has to be defined. Then the filesystem variant of the Validators could be used on GCC 8. GCC 9+ does not have this issue so the `<filesystem>` is used by default. 191 +Specifically `libstdc++fs` needs to be added to the linking list and `CLI11_HAS_FILESYSTEM=1` has to be defined. Then the filesystem variant of the Validators could be used on GCC 8. GCC 9+ does not have this issue so the `<filesystem>` is used by default.
192 192
193 There may also be other cases where a specific library needs to be linked. 193 There may also be other cases where a specific library needs to be linked.
194 194
195 -Defining `CLI11_HAS_FILESYSTEM=0` which will remove the usage and hence any linking issue. 195 +Defining `CLI11_HAS_FILESYSTEM=0` which will remove the usage and hence any linking issue.
196 196
197 -In some cases certain clang compilations may require linking against `libc++fs`. These situations have not been encountered so the specific situations requiring them are unknown yet. 197 +In some cases certain clang compilations may require linking against `libc++fs`. These situations have not been encountered so the specific situations requiring them are unknown yet.
198 198
199 </p></details> 199 </p></details>
200 </br> 200 </br>
@@ -232,7 +232,7 @@ The try/catch block ensures that `-h,--help` or a parse error will exit with the @@ -232,7 +232,7 @@ The try/catch block ensures that `-h,--help` or a parse error will exit with the
232 </p></details> 232 </p></details>
233 </br> 233 </br>
234 234
235 -The initialization is just one line, adding options is just two each. The parse macro is just one line (or 5 for the contents of the macro). After the app runs, the filename will be set to the correct value if it was passed, otherwise it will be set to the default. You can check to see if this was passed on the command line with `app.count("--file")`. 235 +The initialization is just one line, adding options is just two each. The parse macro is just one line (or 5 for the contents of the macro). After the app runs, the filename will be set to the correct value if it was passed, otherwise it will be set to the default. You can check to see if this was passed on the command line with `app.count("--file")`.
236 236
237 #### Option types 237 #### Option types
238 238
@@ -279,7 +279,7 @@ Option_group *app.add_option_group(name,description); @@ -279,7 +279,7 @@ Option_group *app.add_option_group(name,description);
279 279
280 An option name may start with any character except ('-', ' ', '\n', and '!'). For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n'). For the `add_flag*` functions '{' and '!' have special meaning which is why they are not allowed. Names are given as a comma separated string, with the dash or dashes. An option or flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form. 280 An option name may start with any character except ('-', ' ', '\n', and '!'). For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n'). For the `add_flag*` functions '{' and '!' have special meaning which is why they are not allowed. Names are given as a comma separated string, with the dash or dashes. An option or flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form.
281 281
282 -The `add_option_function<type>(...` function will typically require the template parameter be given unless a `std::function` object with an exact match is passed. The type can be any type supported by the `add_option` function. The function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` possibly) if the value is not valid. 282 +The `add_option_function<type>(...` function will typically require the template parameter be given unless a `std::function` object with an exact match is passed. The type can be any type supported by the `add_option` function. The function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` possibly) if the value is not valid.
283 283
284 The two parameter template overload can be used in cases where you want to restrict the input such as 284 The two parameter template overload can be used in cases where you want to restrict the input such as
285 285
@@ -288,7 +288,7 @@ double val @@ -288,7 +288,7 @@ double val
288 app.add_option<double,unsigned int>("-v",val); 288 app.add_option<double,unsigned int>("-v",val);
289 ``` 289 ```
290 290
291 -which would first verify the input is convertible to an `unsigned int` before assigning it. Or using some variant type 291 +which would first verify the input is convertible to an `unsigned int` before assigning it. Or using some variant type
292 292
293 ```cpp 293 ```cpp
294 using vtype=std::variant<int, double, std::string>; 294 using vtype=std::variant<int, double, std::string>;
@@ -298,9 +298,9 @@ app.add_option&lt;vtype,int&gt;(&quot;--vi&quot;,v1); @@ -298,9 +298,9 @@ app.add_option&lt;vtype,int&gt;(&quot;--vi&quot;,v1);
298 app.add_option<vtype,double>("--vf",v1); 298 app.add_option<vtype,double>("--vf",v1);
299 ``` 299 ```
300 300
301 -otherwise the output would default to a string. The `add_option` can be used with any integral or floating point types, enumerations, or strings. Or any type that takes an int, double, or std\::string in an assignment operator or constructor. If an object can take multiple varieties of those, std::string takes precedence, then double then int. To better control which one is used or to use another type for the underlying conversions use the two parameter template to directly specify the conversion type. 301 +otherwise the output would default to a string. The `add_option` can be used with any integral or floating point types, enumerations, or strings. Or any type that takes an int, double, or std\::string in an assignment operator or constructor. If an object can take multiple varieties of those, std::string takes precedence, then double then int. To better control which one is used or to use another type for the underlying conversions use the two parameter template to directly specify the conversion type.
302 302
303 -Types such as (std or boost) `optional<int>`, `optional<double>`, and `optional<string>` and any other wrapper types are supported directly. For purposes of CLI11 wrapper types are those which `value_type` definition. See [CLI11 Advanced Topics/Custom Converters][] for information on how you can add your own converters for additional types. 303 +Types such as (std or boost) `optional<int>`, `optional<double>`, and `optional<string>` and any other wrapper types are supported directly. For purposes of CLI11 wrapper types are those which `value_type` definition. See [CLI11 Advanced Topics/Custom Converters][] for information on how you can add your own converters for additional types.
304 304
305 Vector types can also be used in the two parameter template overload 305 Vector types can also be used in the two parameter template overload
306 306
@@ -311,35 +311,35 @@ app.add_option&lt;std::vector&lt;double&gt;,int&gt;(&quot;--vs&quot;,v1); @@ -311,35 +311,35 @@ app.add_option&lt;std::vector&lt;double&gt;,int&gt;(&quot;--vs&quot;,v1);
311 311
312 would load a vector of doubles but ensure all values can be represented as integers. 312 would load a vector of doubles but ensure all values can be represented as integers.
313 313
314 -Automatic direct capture of the default string is disabled when using the two parameter template. Use `set_default_str(...)` or `->default_function(std::string())` to set the default string or capture function directly for these cases. 314 +Automatic direct capture of the default string is disabled when using the two parameter template. Use `set_default_str(...)` or `->default_function(std::string())` to set the default string or capture function directly for these cases.
315 315
316 -Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example: 316 +Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example:
317 317
318 ```cpp 318 ```cpp
319 app.add_flag("--flag,!--no-flag",result,"help for flag"); 319 app.add_flag("--flag,!--no-flag",result,"help for flag");
320 ``` 320 ```
321 321
322 specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is 322 specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is
323 -passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An 323 +passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An
324 alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous 324 alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous
325 -example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the 325 +example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the
326 default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum 326 default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum
327 -all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited). 327 +all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited).
328 The default value can be any value. For example if you wished to define a numerical flag: 328 The default value can be any value. For example if you wished to define a numerical flag:
329 329
330 ```cpp 330 ```cpp
331 app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag") 331 app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag")
332 ``` 332 ```
333 333
334 -Using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type. 334 +Using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type.
335 335
336 On a `C++14` compiler, you can pass a callback function directly to `.add_flag`, while in C++11 mode you'll need to use `.add_flag_function` if you want a callback function. The function will be given the number of times the flag was passed. You can throw a relevant `CLI::ParseError` to signal a failure. 336 On a `C++14` compiler, you can pass a callback function directly to `.add_flag`, while in C++11 mode you'll need to use `.add_flag_function` if you want a callback function. The function will be given the number of times the flag was passed. You can throw a relevant `CLI::ParseError` to signal a failure.
337 337
338 #### Example 338 #### Example
339 339
340 -* `"one,-o,--one"`: Valid as long as not a flag, would create an option that can be specified positionally, or with `-o` or `--one`  
341 -* `"this"` Can only be passed positionally  
342 -* `"-a,-b,-c"` No limit to the number of non-positional option names 340 +- `"one,-o,--one"`: Valid as long as not a flag, would create an option that can be specified positionally, or with `-o` or `--one`
  341 +- `"this"` Can only be passed positionally
  342 +- `"-a,-b,-c"` No limit to the number of non-positional option names
343 343
344 The add commands return a pointer to an internally stored `Option`. 344 The add commands return a pointer to an internally stored `Option`.
345 This option can be used directly to check for the count (`->count()`) after parsing to avoid a string based lookup. 345 This option can be used directly to check for the count (`->count()`) after parsing to avoid a string based lookup.
@@ -348,64 +348,64 @@ This option can be used directly to check for the count (`-&gt;count()`) after pars @@ -348,64 +348,64 @@ This option can be used directly to check for the count (`-&gt;count()`) after pars
348 348
349 Before parsing, you can set the following options: 349 Before parsing, you can set the following options:
350 350
351 -* `->required()`: The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works.  
352 -* `->expected(N)`: Take `N` values instead of as many as possible, only for vector args. If negative, require at least `-N`; end with `--` or another recognized option or subcommand.  
353 -* `->expected(MIN,MAX)`: Set a range of expected values to accompany an option. `expected(0,1)` is the equivalent of making a flag.  
354 -* `->type_name(typename)`: Set the name of an Option's type (`type_name_fn` allows a function instead)  
355 -* `->type_size(N)`: Set the intrinsic size of an option value. The parser will require multiples of this number if negative. Most of the time this is detected automatically though can be modified for specific use cases.  
356 -* `->type_size(MIN,MAX)`: Set the intrinsic size of an option to a range.  
357 -* `->needs(opt)`: This option requires another option to also be present, opt is an `Option` pointer. Options can be removed from the `needs` with `remove_needs(opt)`. The option can also be specified with a string containing the name of the option  
358 -* `->excludes(opt)`: This option cannot be given with `opt` present, opt is an `Option` pointer. Can also be given as a string containing the name of the option. Options can be removed from the excludes list with `->remove_excludes(opt)`  
359 -* `->envname(name)`: Gets the value from the environment if present and not passed on the command line.  
360 -* `->group(name)`: The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `""` will not show up in the help print (hidden).  
361 -* `->ignore_case()`: Ignore the case on the command line (also works on subcommands, does not affect arguments).  
362 -* `->ignore_underscore()`: Ignore any underscores in the options names (also works on subcommands, does not affect arguments). For example "option_one" will match with "optionone". This does not apply to short form options since they only have one character  
363 -* `->disable_flag_override()`: From the command line long form flag options can be assigned a value on the command line using the `=` notation `--flag=value`. If this behavior is not desired, the `disable_flag_override()` disables it and will generate an exception if it is done on the command line. The `=` does not work with short form flag options.  
364 -* `->allow_extra_args(true/false)`: If set to true the option will take an unlimited number of arguments like a vector, if false it will limit the number of arguments to the size of the type used in the option. Default value depends on the nature of the type use, containers default to true, others default to false.  
365 -* `->delimiter(char)`: Allows specification of a custom delimiter for separating single arguments into vector arguments, for example specifying `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a vector value.  
366 -* `->description(str)`: Set/change the description.  
367 -* `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, and `->join()`. This will only affect options expecting 1 argument or bool flags (which do not inherit their default but always start with a specific policy). `->join(delim)` can also be used to join with a specific delimiter. This equivalent to calling `->delimiter(delim)` and `->join()`. Valid values are `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::TakeLast`, `CLI::MultiOptionPolicy::TakeFirst`, `CLI::MultiOptionPolicy::Join`, `CLI::MultiOptionPolicy::TakeAll`, and `CLI::MultiOptionPolicy::Sum` ๐Ÿšง.  
368 -* `->check(std::string(const std::string &), validator_name="",validator_description="")`: Define a check function. The function should return a non empty string with the error message if the check fails  
369 -* `->check(Validator)`: Use a Validator object to do the check see [Validators](#validators) for a description of available Validators and how to create new ones.  
370 -* `->transform(std::string(std::string &), validator_name="",validator_description=")`: Converts the input string into the output string, in-place in the parsed options.  
371 -* `->transform(Validator)`: Uses a Validator object to do the transformation see [Validators](#validators) for a description of available Validators and how to create new ones.  
372 -* `->each(void(const std::string &)>`: Run this function on each value received, as it is received. It should throw a `ValidationError` if an error is encountered.  
373 -* `->configurable(false)`: Disable this option from being in a configuration file.  
374 -* `->capture_default_str()`: Store the current value attached and display it in the help string.  
375 -* `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.  
376 -* `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.  
377 -* `->default_str(string)`: Set the default string directly (NO VALIDATION OR CALLBACKS). This string will also be used as a default value if no arguments are passed and the value is requested.  
378 -* `->default_val(value)`: Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). The callback may be triggered if the `run_callback_for_default` is set.  
379 -* `->run_callback_for_default()`: This will force the option callback to be executed or the variable set when the `default_val` is set.  
380 -* `->option_text(string)`: Sets the text between the option name and description.  
381 -* `->force_callback()`: Causes the option callback or value set to be triggered even if the option was not present in parsing.  
382 -* `->trigger_on_parse()`: If set, causes the callback and all associated validation checks for the option to be executed when the option value is parsed vs. at the end of all parsing. This could cause the callback to be executed multiple times. Also works with positional options ๐Ÿ†•. 351 +- `->required()`: The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works.
  352 +- `->expected(N)`: Take `N` values instead of as many as possible, only for vector args. If negative, require at least `-N`; end with `--` or another recognized option or subcommand.
  353 +- `->expected(MIN,MAX)`: Set a range of expected values to accompany an option. `expected(0,1)` is the equivalent of making a flag.
  354 +- `->type_name(typename)`: Set the name of an Option's type (`type_name_fn` allows a function instead)
  355 +- `->type_size(N)`: Set the intrinsic size of an option value. The parser will require multiples of this number if negative. Most of the time this is detected automatically though can be modified for specific use cases.
  356 +- `->type_size(MIN,MAX)`: Set the intrinsic size of an option to a range.
  357 +- `->needs(opt)`: This option requires another option to also be present, opt is an `Option` pointer. Options can be removed from the `needs` with `remove_needs(opt)`. The option can also be specified with a string containing the name of the option
  358 +- `->excludes(opt)`: This option cannot be given with `opt` present, opt is an `Option` pointer. Can also be given as a string containing the name of the option. Options can be removed from the excludes list with `->remove_excludes(opt)`
  359 +- `->envname(name)`: Gets the value from the environment if present and not passed on the command line.
  360 +- `->group(name)`: The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `""` will not show up in the help print (hidden).
  361 +- `->ignore_case()`: Ignore the case on the command line (also works on subcommands, does not affect arguments).
  362 +- `->ignore_underscore()`: Ignore any underscores in the options names (also works on subcommands, does not affect arguments). For example "option_one" will match with "optionone". This does not apply to short form options since they only have one character
  363 +- `->disable_flag_override()`: From the command line long form flag options can be assigned a value on the command line using the `=` notation `--flag=value`. If this behavior is not desired, the `disable_flag_override()` disables it and will generate an exception if it is done on the command line. The `=` does not work with short form flag options.
  364 +- `->allow_extra_args(true/false)`: If set to true the option will take an unlimited number of arguments like a vector, if false it will limit the number of arguments to the size of the type used in the option. Default value depends on the nature of the type use, containers default to true, others default to false.
  365 +- `->delimiter(char)`: Allows specification of a custom delimiter for separating single arguments into vector arguments, for example specifying `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a vector value.
  366 +- `->description(str)`: Set/change the description.
  367 +- `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, and `->join()`. This will only affect options expecting 1 argument or bool flags (which do not inherit their default but always start with a specific policy). `->join(delim)` can also be used to join with a specific delimiter. This equivalent to calling `->delimiter(delim)` and `->join()`. Valid values are `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::TakeLast`, `CLI::MultiOptionPolicy::TakeFirst`, `CLI::MultiOptionPolicy::Join`, `CLI::MultiOptionPolicy::TakeAll`, and `CLI::MultiOptionPolicy::Sum` ๐Ÿšง.
  368 +- `->check(std::string(const std::string &), validator_name="",validator_description="")`: Define a check function. The function should return a non empty string with the error message if the check fails
  369 +- `->check(Validator)`: Use a Validator object to do the check see [Validators](#validators) for a description of available Validators and how to create new ones.
  370 +- `->transform(std::string(std::string &), validator_name="",validator_description=")`: Converts the input string into the output string, in-place in the parsed options.
  371 +- `->transform(Validator)`: Uses a Validator object to do the transformation see [Validators](#validators) for a description of available Validators and how to create new ones.
  372 +- `->each(void(const std::string &)>`: Run this function on each value received, as it is received. It should throw a `ValidationError` if an error is encountered.
  373 +- `->configurable(false)`: Disable this option from being in a configuration file.
  374 +- `->capture_default_str()`: Store the current value attached and display it in the help string.
  375 +- `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.
  376 +- `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.
  377 +- `->default_str(string)`: Set the default string directly (NO VALIDATION OR CALLBACKS). This string will also be used as a default value if no arguments are passed and the value is requested.
  378 +- `->default_val(value)`: Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). The callback may be triggered if the `run_callback_for_default` is set.
  379 +- `->run_callback_for_default()`: This will force the option callback to be executed or the variable set when the `default_val` is set.
  380 +- `->option_text(string)`: Sets the text between the option name and description.
  381 +- `->force_callback()`: Causes the option callback or value set to be triggered even if the option was not present in parsing.
  382 +- `->trigger_on_parse()`: If set, causes the callback and all associated validation checks for the option to be executed when the option value is parsed vs. at the end of all parsing. This could cause the callback to be executed multiple times. Also works with positional options ๐Ÿ†•.
383 383
384 These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. The `each` function takes any function that has the signature `void(const std::string&)`; it should throw a `ValidationError` when validation fails. The help message will have the name of the parent option prepended. Since `each`, `check` and `transform` use the same underlying mechanism, you can chain as many as you want, and they will be executed in order. Operations added through `transform` are executed first in reverse order of addition, and `check` and `each` are run following the transform functions in order of addition. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results. 384 These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. The `each` function takes any function that has the signature `void(const std::string&)`; it should throw a `ValidationError` when validation fails. The help message will have the name of the parent option prepended. Since `each`, `check` and `transform` use the same underlying mechanism, you can chain as many as you want, and they will be executed in order. Operations added through `transform` are executed first in reverse order of addition, and `check` and `each` are run following the transform functions in order of addition. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results.
385 385
386 On the command line, options can be given as: 386 On the command line, options can be given as:
387 387
388 -* `-a` (flag)  
389 -* `-abc` (flags can be combined)  
390 -* `-f filename` (option)  
391 -* `-ffilename` (no space required)  
392 -* `-abcf filename` (flags and option can be combined)  
393 -* `--long` (long flag)  
394 -* `--long_flag=true` (long flag with equals to override default value)  
395 -* `--file filename` (space)  
396 -* `--file=filename` (equals) 388 +- `-a` (flag)
  389 +- `-abc` (flags can be combined)
  390 +- `-f filename` (option)
  391 +- `-ffilename` (no space required)
  392 +- `-abcf filename` (flags and option can be combined)
  393 +- `--long` (long flag)
  394 +- `--long_flag=true` (long flag with equals to override default value)
  395 +- `--file filename` (space)
  396 +- `--file=filename` (equals)
397 397
398 If `allow_windows_style_options()` is specified in the application or subcommand options can also be given as: 398 If `allow_windows_style_options()` is specified in the application or subcommand options can also be given as:
399 399
400 -* `/a` (flag)  
401 -* `/f filename` (option)  
402 -* `/long` (long flag)  
403 -* `/file filename` (space)  
404 -* `/file:filename` (colon)  
405 -* `/long_flag:false` (long flag with : to override the default value)  
406 - * Windows style options do not allow combining short options or values not separated from the short option like with `-` options 400 +- `/a` (flag)
  401 +- `/f filename` (option)
  402 +- `/long` (long flag)
  403 +- `/file filename` (space)
  404 +- `/file:filename` (colon)
  405 +- `/long_flag:false` (long flag with : to override the default value)
  406 + - Windows style options do not allow combining short options or values not separated from the short option like with `-` options
407 407
408 -Long flag options may be given with an `=<value>` to allow specifying a false value, or some other value to the flag. See [config files](#configuration-file) for details on the values supported. NOTE: only the `=` or `:` for windows-style options may be used for this, using a space will result in the argument being interpreted as a positional argument. This syntax can override the default values, and can be disabled by using `disable_flag_override()`. 408 +Long flag options may be given with an `=<value>` to allow specifying a false value, or some other value to the flag. See [config files](#configuration-file) for details on the values supported. NOTE: only the `=` or `:` for windows-style options may be used for this, using a space will result in the argument being interpreted as a positional argument. This syntax can override the default values, and can be disabled by using `disable_flag_override()`.
409 409
410 Extra positional arguments will cause the program to exit, so at least one positional option with a vector is recommended if you want to allow extraneous arguments. 410 Extra positional arguments will cause the program to exit, so at least one positional option with a vector is recommended if you want to allow extraneous arguments.
411 If you set `.allow_extras()` on the main `App`, you will not get an error. You can access the missing options using `remaining` (if you have subcommands, `app.remaining(true)` will get all remaining options, subcommands included). 411 If you set `.allow_extras()` on the main `App`, you will not get an error. You can access the missing options using `remaining` (if you have subcommands, `app.remaining(true)` will get all remaining options, subcommands included).
@@ -416,27 +416,28 @@ If `--` is present in the command line that does not end an unlimited option, th @@ -416,27 +416,28 @@ If `--` is present in the command line that does not end an unlimited option, th
416 everything after that is positional only. 416 everything after that is positional only.
417 417
418 #### Validators 418 #### Validators
419 -Validators are structures to check or modify inputs, they can be used to verify that an input meets certain criteria or transform it into another value. They are added through the `check` or `transform` functions. The differences between the two function are that checks do not modify the input whereas transforms can and are executed before any Validators added through `check`. 419 +
  420 +Validators are structures to check or modify inputs, they can be used to verify that an input meets certain criteria or transform it into another value. They are added through the `check` or `transform` functions. The differences between the two function are that checks do not modify the input whereas transforms can and are executed before any Validators added through `check`.
420 421
421 CLI11 has several Validators built-in that perform some common checks 422 CLI11 has several Validators built-in that perform some common checks
422 423
423 -* `CLI::IsMember(...)`: Require an option be a member of a given set. See [Transforming Validators](#transforming-validators) for more details.  
424 -* `CLI::Transformer(...)`: Modify the input using a map. See [Transforming Validators](#transforming-validators) for more details.  
425 -* `CLI::CheckedTransformer(...)`: Modify the input using a map, and require that the input is either in the set or already one of the outputs of the set. See [Transforming Validators](#transforming-validators) for more details.  
426 -* `CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching the unit and multiplying the number by the corresponding factor. It can be used as a base for transformers, that accept things like size values (`1 KB`) or durations (`0.33 ms`).  
427 -* `CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 or 2^10.  
428 -* `CLI::ExistingFile`: Requires that the file exists if given.  
429 -* `CLI::ExistingDirectory`: Requires that the directory exists.  
430 -* `CLI::ExistingPath`: Requires that the path (file or directory) exists.  
431 -* `CLI::NonexistentPath`: Requires that the path does not exist.  
432 -* `CLI::FileOnDefaultPath`: ๐Ÿ†• Best used as a transform, Will check that a file exists either directly or in a default path and update the path appropriately. See [Transforming Validators](#transforming-validators) for more details  
433 -* `CLI::Range(min,max)`: Requires that the option be between min and max (make sure to use floating point if needed). Min defaults to 0.  
434 -* `CLI::Bounded(min,max)`: Modify the input such that it is always between min and max (make sure to use floating point if needed). Min defaults to 0. Will produce an error if conversion is not possible.  
435 -* `CLI::PositiveNumber`: Requires the number be greater than 0  
436 -* `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0  
437 -* `CLI::Number`: Requires the input be a number.  
438 -* `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. `'255.255.255.255'`, `'10.1.1.7'`.  
439 -* `CLI::TypeValidator<TYPE>`:Requires that the option be convertible to the specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that the input be convertible to an `unsigned int` regardless of the end conversion. 424 +- `CLI::IsMember(...)`: Require an option be a member of a given set. See [Transforming Validators](#transforming-validators) for more details.
  425 +- `CLI::Transformer(...)`: Modify the input using a map. See [Transforming Validators](#transforming-validators) for more details.
  426 +- `CLI::CheckedTransformer(...)`: Modify the input using a map, and require that the input is either in the set or already one of the outputs of the set. See [Transforming Validators](#transforming-validators) for more details.
  427 +- `CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching the unit and multiplying the number by the corresponding factor. It can be used as a base for transformers, that accept things like size values (`1 KB`) or durations (`0.33 ms`).
  428 +- `CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 or 2^10.
  429 +- `CLI::ExistingFile`: Requires that the file exists if given.
  430 +- `CLI::ExistingDirectory`: Requires that the directory exists.
  431 +- `CLI::ExistingPath`: Requires that the path (file or directory) exists.
  432 +- `CLI::NonexistentPath`: Requires that the path does not exist.
  433 +- `CLI::FileOnDefaultPath`: ๐Ÿ†• Best used as a transform, Will check that a file exists either directly or in a default path and update the path appropriately. See [Transforming Validators](#transforming-validators) for more details
  434 +- `CLI::Range(min,max)`: Requires that the option be between min and max (make sure to use floating point if needed). Min defaults to 0.
  435 +- `CLI::Bounded(min,max)`: Modify the input such that it is always between min and max (make sure to use floating point if needed). Min defaults to 0. Will produce an error if conversion is not possible.
  436 +- `CLI::PositiveNumber`: Requires the number be greater than 0
  437 +- `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0
  438 +- `CLI::Number`: Requires the input be a number.
  439 +- `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. `'255.255.255.255'`, `'10.1.1.7'`.
  440 +- `CLI::TypeValidator<TYPE>`:Requires that the option be convertible to the specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that the input be convertible to an `unsigned int` regardless of the end conversion.
440 441
441 These Validators can be used by simply passing the name into the `check` or `transform` methods on an option 442 These Validators can be used by simply passing the name into the `check` or `transform` methods on an option
442 443
@@ -461,46 +462,46 @@ will produce a check for a number less than or equal to 0. @@ -461,46 +462,46 @@ will produce a check for a number less than or equal to 0.
461 462
462 ##### Transforming Validators 463 ##### Transforming Validators
463 464
464 -There are a few built in Validators that let you transform values if used with the `transform` function. If they also do some checks then they can be used `check` but some may do nothing in that case. 465 +There are a few built in Validators that let you transform values if used with the `transform` function. If they also do some checks then they can be used `check` but some may do nothing in that case.
465 466
466 -* `CLI::Bounded(min,max)` will bound values between min and max and values outside of that range are limited to min or max, it will fail if the value cannot be converted and produce a `ValidationError`  
467 -* The `IsMember` Validator lets you specify a set of predefined options. You can pass any container or copyable pointer (including `std::shared_ptr`) to a container to this Validator; the container just needs to be iterable and have a `::value_type`. The key type should be convertible from a string, You can use an initializer list directly if you like. If you need to modify the set later, the pointer form lets you do that; the type message and check will correctly refer to the current version of the set. The container passed in can be a set, vector, or a map like structure. If used in the `transform` method the output value will be the matching key as it could be modified by filters. 467 +- `CLI::Bounded(min,max)` will bound values between min and max and values outside of that range are limited to min or max, it will fail if the value cannot be converted and produce a `ValidationError`
  468 +- The `IsMember` Validator lets you specify a set of predefined options. You can pass any container or copyable pointer (including `std::shared_ptr`) to a container to this Validator; the container just needs to be iterable and have a `::value_type`. The key type should be convertible from a string, You can use an initializer list directly if you like. If you need to modify the set later, the pointer form lets you do that; the type message and check will correctly refer to the current version of the set. The container passed in can be a set, vector, or a map like structure. If used in the `transform` method the output value will be the matching key as it could be modified by filters.
468 469
469 -After specifying a set of options, you can also specify "filter" functions of the form `T(T)`, where `T` is the type of the values. The most common choices probably will be `CLI::ignore_case` an `CLI::ignore_underscore`, and `CLI::ignore_space`. These all work on strings but it is possible to define functions that work on other types. Here are some examples of `IsMember`: 470 +After specifying a set of options, you can also specify "filter" functions of the form `T(T)`, where `T` is the type of the values. The most common choices probably will be `CLI::ignore_case` an `CLI::ignore_underscore`, and `CLI::ignore_space`. These all work on strings but it is possible to define functions that work on other types. Here are some examples of `IsMember`:
470 471
471 -* `CLI::IsMember({"choice1", "choice2"})`: Select from exact match to choices.  
472 -* `CLI::IsMember({"choice1", "choice2"}, CLI::ignore_case, CLI::ignore_underscore)`: Match things like `Choice_1`, too.  
473 -* `CLI::IsMember(std::set<int>({2,3,4}))`: Most containers and types work; you just need `std::begin`, `std::end`, and `::value_type`.  
474 -* `CLI::IsMember(std::map<std::string, TYPE>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched value with the matched key. The value member of the map is not used in `IsMember`, so it can be any type.  
475 -* `auto p = std::make_shared<std::vector<std::string>>(std::initializer_list<std::string>("one", "two")); CLI::IsMember(p)`: You can modify `p` later.  
476 -* The `Transformer` and `CheckedTransformer` Validators transform one value into another. Any container or copyable pointer (including `std::shared_ptr`) to a container that generates pairs of values can be passed to these `Validator's`; the container just needs to be iterable and have a `::value_type` that consists of pairs. The key type should be convertible from a string, and the value type should be convertible to a string You can use an initializer list directly if you like. If you need to modify the map later, the pointer form lets you do that; the description message will correctly refer to the current version of the map. `Transformer` does not do any checking so values not in the map are ignored. `CheckedTransformer` takes an extra step of verifying that the value is either one of the map key values, in which case it is transformed, or one of the expected output values, and if not will generate a `ValidationError`. A Transformer placed using `check` will not do anything. 472 +- `CLI::IsMember({"choice1", "choice2"})`: Select from exact match to choices.
  473 +- `CLI::IsMember({"choice1", "choice2"}, CLI::ignore_case, CLI::ignore_underscore)`: Match things like `Choice_1`, too.
  474 +- `CLI::IsMember(std::set<int>({2,3,4}))`: Most containers and types work; you just need `std::begin`, `std::end`, and `::value_type`.
  475 +- `CLI::IsMember(std::map<std::string, TYPE>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched value with the matched key. The value member of the map is not used in `IsMember`, so it can be any type.
  476 +- `auto p = std::make_shared<std::vector<std::string>>(std::initializer_list<std::string>("one", "two")); CLI::IsMember(p)`: You can modify `p` later.
  477 +- The `Transformer` and `CheckedTransformer` Validators transform one value into another. Any container or copyable pointer (including `std::shared_ptr`) to a container that generates pairs of values can be passed to these `Validator's`; the container just needs to be iterable and have a `::value_type` that consists of pairs. The key type should be convertible from a string, and the value type should be convertible to a string You can use an initializer list directly if you like. If you need to modify the map later, the pointer form lets you do that; the description message will correctly refer to the current version of the map. `Transformer` does not do any checking so values not in the map are ignored. `CheckedTransformer` takes an extra step of verifying that the value is either one of the map key values, in which case it is transformed, or one of the expected output values, and if not will generate a `ValidationError`. A Transformer placed using `check` will not do anything.
477 478
478 After specifying a map of options, you can also specify "filter" just like in `CLI::IsMember`. 479 After specifying a map of options, you can also specify "filter" just like in `CLI::IsMember`.
479 Here are some examples (`Transformer` and `CheckedTransformer` are interchangeable in the examples) 480 Here are some examples (`Transformer` and `CheckedTransformer` are interchangeable in the examples)
480 of `Transformer`: 481 of `Transformer`:
481 482
482 -* `CLI::Transformer({{"key1", "map1"},{"key2","map2"}})`: Select from key values and produce map values.  
483 -* `CLI::Transformer(std::map<std::string,int>({"two",2},{"three",3},{"four",4}}))`: most maplike containers work, the `::value_type` needs to produce a pair of some kind.  
484 -* `CLI::CheckedTransformer(std::map<std::string, int>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched key with the value. `CheckedTransformer` also requires that the value either match one of the keys or match one of known outputs.  
485 -* `auto p = std::make_shared<CLI::TransformPairs<std::string>>(std::initializer_list<std::pair<std::string,std::string>>({"key1", "map1"},{"key2","map2"})); CLI::Transformer(p)`: You can modify `p` later. `TransformPairs<T>` is an alias for `std::vector<std::pair<<std::string,T>>` 483 +- `CLI::Transformer({{"key1", "map1"},{"key2","map2"}})`: Select from key values and produce map values.
  484 +- `CLI::Transformer(std::map<std::string,int>({"two",2},{"three",3},{"four",4}}))`: most maplike containers work, the `::value_type` needs to produce a pair of some kind.
  485 +- `CLI::CheckedTransformer(std::map<std::string, int>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched key with the value. `CheckedTransformer` also requires that the value either match one of the keys or match one of known outputs.
  486 +- `auto p = std::make_shared<CLI::TransformPairs<std::string>>(std::initializer_list<std::pair<std::string,std::string>>({"key1", "map1"},{"key2","map2"})); CLI::Transformer(p)`: You can modify `p` later. `TransformPairs<T>` is an alias for `std::vector<std::pair<<std::string,T>>`
486 487
487 -NOTES: If the container used in `IsMember`, `Transformer`, or `CheckedTransformer` has a `find` function like `std::unordered_map` or `std::map` then that function is used to do the searching. If it does not have a `find` function a linear search is performed. If there are filters present, the fast search is performed first, and if that fails a linear search with the filters on the key values is performed. 488 +NOTES: If the container used in `IsMember`, `Transformer`, or `CheckedTransformer` has a `find` function like `std::unordered_map` or `std::map` then that function is used to do the searching. If it does not have a `find` function a linear search is performed. If there are filters present, the fast search is performed first, and if that fails a linear search with the filters on the key values is performed.
488 489
489 -* `CLI::FileOnDefaultPath(default_path)`: ๐Ÿ†• can be used to check for files in a default path. If used as a transform it will first check that a file exists, if it does nothing further is done, if it does not it tries to add a default Path to the file and search there again. If the file does not exist an error is returned normally but this can be disabled using CLI::FileOnDefaultPath(default_path, false). This allows multiple paths to be chained using multiple transform calls. 490 +- `CLI::FileOnDefaultPath(default_path)`: ๐Ÿ†• can be used to check for files in a default path. If used as a transform it will first check that a file exists, if it does nothing further is done, if it does not it tries to add a default Path to the file and search there again. If the file does not exist an error is returned normally but this can be disabled using CLI::FileOnDefaultPath(default_path, false). This allows multiple paths to be chained using multiple transform calls.
490 491
491 ##### Validator operations 492 ##### Validator operations
492 493
493 -Validators are copyable and have a few operations that can be performed on them to alter settings. Most of the built in Validators have a default description that is displayed in the help. This can be altered via `.description(validator_description)`. 494 +Validators are copyable and have a few operations that can be performed on them to alter settings. Most of the built in Validators have a default description that is displayed in the help. This can be altered via `.description(validator_description)`.
494 The name of a Validator, which is useful for later reference from the `get_validator(name)` method of an `Option` can be set via `.name(validator_name)` 495 The name of a Validator, which is useful for later reference from the `get_validator(name)` method of an `Option` can be set via `.name(validator_name)`
495 The operation function of a Validator can be set via 496 The operation function of a Validator can be set via
496 -`.operation(std::function<std::string(std::string &>)`. The `.active()` function can activate or deactivate a Validator from the operation. A validator can be set to apply only to a specific element of the output. For example in a pair option `std::pair<int, std::string>` the first element may need to be a positive integer while the second may need to be a valid file. The `.application_index(int)` function can specify this. It is zero based and negative indices apply to all values. 497 +`.operation(std::function<std::string(std::string &>)`. The `.active()` function can activate or deactivate a Validator from the operation. A validator can be set to apply only to a specific element of the output. For example in a pair option `std::pair<int, std::string>` the first element may need to be a positive integer while the second may need to be a valid file. The `.application_index(int)` function can specify this. It is zero based and negative indices apply to all values.
497 498
498 ```cpp 499 ```cpp
499 opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0)); 500 opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0));
500 opt->check(CLI::Validator(CLI::ExistingFile).application_index(1)); 501 opt->check(CLI::Validator(CLI::ExistingFile).application_index(1));
501 ``` 502 ```
502 503
503 -All the validator operation functions return a Validator reference allowing them to be chained. For example 504 +All the validator operation functions return a Validator reference allowing them to be chained. For example
504 505
505 ```cpp 506 ```cpp
506 opt->check(CLI::Range(10,20).description("range is limited to sensible values").active(false).name("range")); 507 opt->check(CLI::Range(10,20).description("range is limited to sensible values").active(false).name("range"));
@@ -527,7 +528,7 @@ or if the operation function is set later they can be created with @@ -527,7 +528,7 @@ or if the operation function is set later they can be created with
527 CLI::Validator(validator_description); 528 CLI::Validator(validator_description);
528 ``` 529 ```
529 530
530 - It is also possible to create a subclass of `CLI::Validator`, in which case it can also set a custom description function, and operation function. 531 +It is also possible to create a subclass of `CLI::Validator`, in which case it can also set a custom description function, and operation function.
531 532
532 ##### Querying Validators 533 ##### Querying Validators
533 534
@@ -537,7 +538,7 @@ Once loaded into an Option, a pointer to a named Validator can be retrieved via @@ -537,7 +538,7 @@ Once loaded into an Option, a pointer to a named Validator can be retrieved via
537 opt->get_validator(name); 538 opt->get_validator(name);
538 ``` 539 ```
539 540
540 -This will retrieve a Validator with the given name or throw a `CLI::OptionNotFound` error. If no name is given or name is empty the first unnamed Validator will be returned or the first Validator if there is only one. 541 +This will retrieve a Validator with the given name or throw a `CLI::OptionNotFound` error. If no name is given or name is empty the first unnamed Validator will be returned or the first Validator if there is only one.
541 542
542 or 543 or
543 544
@@ -545,22 +546,22 @@ or @@ -545,22 +546,22 @@ or
545 opt->get_validator(index); 546 opt->get_validator(index);
546 ``` 547 ```
547 548
548 -Which will return a validator in the index it is applied which isn't necessarily the order in which was defined. The pointer can be `nullptr` if an invalid index is given. 549 +Which will return a validator in the index it is applied which isn't necessarily the order in which was defined. The pointer can be `nullptr` if an invalid index is given.
549 Validators have a few functions to query the current values: 550 Validators have a few functions to query the current values:
550 551
551 -* `get_description()`: Will return a description string  
552 -* `get_name()`: Will return the Validator name  
553 -* `get_active()`: Will return the current active state, true if the Validator is active.  
554 -* `get_application_index()`: Will return the current application index.  
555 -* `get_modifying()`: Will return true if the Validator is allowed to modify the input, this can be controlled via the `non_modifying()` method, though it is recommended to let `check` and `transform` option methods manipulate it if needed. 552 +- `get_description()`: Will return a description string
  553 +- `get_name()`: Will return the Validator name
  554 +- `get_active()`: Will return the current active state, true if the Validator is active.
  555 +- `get_application_index()`: Will return the current application index.
  556 +- `get_modifying()`: Will return true if the Validator is allowed to modify the input, this can be controlled via the `non_modifying()` method, though it is recommended to let `check` and `transform` option methods manipulate it if needed.
556 557
557 #### Getting results 558 #### Getting results
558 559
559 -In most cases, the fastest and easiest way is to return the results through a callback or variable specified in one of the `add_*` functions. But there are situations where this is not possible or desired. For these cases the results may be obtained through one of the following functions. Please note that these functions will do any type conversions and processing during the call so should not used in performance critical code: 560 +In most cases, the fastest and easiest way is to return the results through a callback or variable specified in one of the `add_*` functions. But there are situations where this is not possible or desired. For these cases the results may be obtained through one of the following functions. Please note that these functions will do any type conversions and processing during the call so should not used in performance critical code:
560 561
561 -* `->results()`: Retrieves a vector of strings with all the results in the order they were given.  
562 -* `->results(variable_to_bind_to)`: Gets the results according to the MultiOptionPolicy and converts them just like the `add_option_function` with a variable.  
563 -* `Value=opt->as<type>()`: Returns the result or default value directly as the specified type if possible, can be vector to return all results, and a non-vector to get the result according to the MultiOptionPolicy in place. 562 +- `->results()`: Retrieves a vector of strings with all the results in the order they were given.
  563 +- `->results(variable_to_bind_to)`: Gets the results according to the MultiOptionPolicy and converts them just like the `add_option_function` with a variable.
  564 +- `Value=opt->as<type>()`: Returns the result or default value directly as the specified type if possible, can be vector to return all results, and a non-vector to get the result according to the MultiOptionPolicy in place.
564 565
565 ### Subcommands 566 ### Subcommands
566 567
@@ -576,77 +577,77 @@ All `App`s have a `get_subcommands()` method, which returns a list of pointers t @@ -576,77 +577,77 @@ All `App`s have a `get_subcommands()` method, which returns a list of pointers t
576 For many cases, however, using an app's callback capabilities may be easier. Every app has a set of callbacks that can be executed at various stages of parsing; a `C++` lambda function (with capture to get parsed values) can be used as input to the callback definition function. If you throw `CLI::Success` or `CLI::RuntimeError(return_value)`, you can 577 For many cases, however, using an app's callback capabilities may be easier. Every app has a set of callbacks that can be executed at various stages of parsing; a `C++` lambda function (with capture to get parsed values) can be used as input to the callback definition function. If you throw `CLI::Success` or `CLI::RuntimeError(return_value)`, you can
577 even exit the program through the callback. 578 even exit the program through the callback.
578 579
579 -Multiple subcommands are allowed, to allow [`Click`][click] like series of commands (order is preserved). The same subcommand can be triggered multiple times but all positional arguments will take precedence over the second and future calls of the subcommand. `->count()` on the subcommand will return the number of times the subcommand was called. The subcommand callback will only be triggered once unless the `.immediate_callback()` flag is set or the callback is specified through the `parse_complete_callback()` function. The `final_callback()` is triggered only once. In which case the callback executes on completion of the subcommand arguments but after the arguments for that subcommand have been parsed, and can be triggered multiple times. 580 +Multiple subcommands are allowed, to allow [`Click`][click] like series of commands (order is preserved). The same subcommand can be triggered multiple times but all positional arguments will take precedence over the second and future calls of the subcommand. `->count()` on the subcommand will return the number of times the subcommand was called. The subcommand callback will only be triggered once unless the `.immediate_callback()` flag is set or the callback is specified through the `parse_complete_callback()` function. The `final_callback()` is triggered only once. In which case the callback executes on completion of the subcommand arguments but after the arguments for that subcommand have been parsed, and can be triggered multiple times.
580 581
581 Subcommands may also have an empty name either by calling `add_subcommand` with an empty string for the name or with no arguments. 582 Subcommands may also have an empty name either by calling `add_subcommand` with an empty string for the name or with no arguments.
582 -Nameless subcommands function a similarly to groups in the main `App`. See [Option groups](#option-groups) to see how this might work. If an option is not defined in the main App, all nameless subcommands are checked as well. This allows for the options to be defined in a composable group. The `add_subcommand` function has an overload for adding a `shared_ptr<App>` so the subcommand(s) could be defined in different components and merged into a main `App`, or possibly multiple `Apps`. Multiple nameless subcommands are allowed. Callbacks for nameless subcommands are only triggered if any options from the subcommand were parsed. Subcommand names given through the `add_subcommand` method have the same restrictions as option names. 583 +Nameless subcommands function a similarly to groups in the main `App`. See [Option groups](#option-groups) to see how this might work. If an option is not defined in the main App, all nameless subcommands are checked as well. This allows for the options to be defined in a composable group. The `add_subcommand` function has an overload for adding a `shared_ptr<App>` so the subcommand(s) could be defined in different components and merged into a main `App`, or possibly multiple `Apps`. Multiple nameless subcommands are allowed. Callbacks for nameless subcommands are only triggered if any options from the subcommand were parsed. Subcommand names given through the `add_subcommand` method have the same restrictions as option names.
583 584
584 #### Subcommand options 585 #### Subcommand options
585 586
586 There are several options that are supported on the main app and subcommands and option_groups. These are: 587 There are several options that are supported on the main app and subcommands and option_groups. These are:
587 588
588 -* `.ignore_case()`: Ignore the case of this subcommand. Inherited by added subcommands, so is usually used on the main `App`.  
589 -* `.ignore_underscore()`: Ignore any underscores in the subcommand name. Inherited by added subcommands, so is usually used on the main `App`.  
590 -* `.allow_windows_style_options()`: Allow command line options to be parsed in the form of `/s /long /file:file_name.ext` This option does not change how options are specified in the `add_option` calls or the ability to process options in the form of `-s --long --file=file_name.ext`.  
591 -* `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent option. Subcommands always are allowed to "fall through" as in they will first attempt to match on the current subcommand and if they fail will progressively check parents for matching subcommands.  
592 -* `.configurable()`: Allow the subcommand to be triggered from a configuration file. By default subcommand options in a configuration file do not trigger a subcommand but will just update default values.  
593 -* `.disable()`: Specify that the subcommand is disabled, if given with a bool value it will enable or disable the subcommand or option group.  
594 -* `.disabled_by_default()`: Specify that at the start of parsing the subcommand/option_group should be disabled. This is useful for allowing some Subcommands to trigger others.  
595 -* `.enabled_by_default()`: Specify that at the start of each parse the subcommand/option_group should be enabled. This is useful for allowing some Subcommands to disable others.  
596 -* `.silent()`: Specify that the subcommand is silent meaning that if used it won't show up in the subcommand list. This allows the use of subcommands as modifiers  
597 -* `.validate_positionals()`: Specify that positionals should pass validation before matching. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional or extra arguments.  
598 -* `.validate_optional_arguments()`:๐Ÿ†• Specify that optional arguments should pass validation before being assigned to an option. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional subcommand or extra arguments.  
599 -* `.excludes(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, these subcommands cannot be given together. In the case of options, if the option is passed the subcommand cannot be used and will generate an error.  
600 -* `.needs(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, the subcommands will require the given option to have been given before this subcommand is validated which occurs prior to execution of any callback or after parsing is completed.  
601 -* `.require_option()`: Require 1 or more options or option groups be used.  
602 -* `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.  
603 -* `.require_option(min, max)`: Explicitly set min and max allowed options or option groups. Setting `max` to 0 implies unlimited options.  
604 -* `.require_subcommand()`: Require 1 or more subcommands.  
605 -* `.require_subcommand(N)`: Require `N` subcommands if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.  
606 -* `.require_subcommand(min, max)`: Explicitly set min and max allowed subcommands. Setting `max` to 0 is unlimited.  
607 -* `.add_subcommand(name="", description="")`: Add a subcommand, returns a pointer to the internally stored subcommand.  
608 -* `.add_subcommand(shared_ptr<App>)`: Add a subcommand by shared_ptr, returns a pointer to the internally stored subcommand.  
609 -* `.remove_subcommand(App)`: Remove a subcommand from the app or subcommand.  
610 -* `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on the command line.  
611 -* `.get_subcommands(filter)`: The list of subcommands that match a particular filter function.  
612 -* `.add_option_group(name="", description="")`: Add an [option group](#option-groups) to an App, an option group is specialized subcommand intended for containing groups of options or other groups for controlling how options interact.  
613 -* `.get_parent()`: Get the parent App or `nullptr` if called on main App.  
614 -* `.get_option(name)`: Get an option pointer by option name will throw if the specified option is not available, nameless subcommands are also searched  
615 -* `.get_option_no_throw(name)`: Get an option pointer by option name. This function will return a `nullptr` instead of throwing if the option is not available.  
616 -* `.get_options(filter)`: Get the list of all defined option pointers (useful for processing the app for custom output formats).  
617 -* `.parse_order()`: Get the list of option pointers in the order they were parsed (including duplicates).  
618 -* `.formatter(fmt)`: Set a formatter, with signature `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more details.  
619 -* `.description(str)`: Set/change the description.  
620 -* `.get_description()`: Access the description.  
621 -* `.alias(str)`: set an alias for the subcommand, this allows subcommands to be called by more than one name.  
622 -* `.parsed()`: True if this subcommand was given on the command line.  
623 -* `.count()`: Returns the number of times the subcommand was called.  
624 -* `.count(option_name)`: Returns the number of times a particular option was called.  
625 -* `.count_all()`: Returns the total number of arguments a particular subcommand processed, on the main App it returns the total number of processed commands.  
626 -* `.name(name)`: Add or change the name.  
627 -* `.callback(void() function)`: Set the callback for an app. Either sets the `pre_parse_callback` or the `final_callback` depending on the value of `immediate_callback`. See [Subcommand callbacks](#callbacks) for some additional details.  
628 -* `.parse_complete_callback(void() function)`: Set the callback that runs at the completion of parsing. For subcommands this is executed at the completion of the single subcommand and can be executed multiple times. See [Subcommand callbacks](#callbacks) for some additional details.  
629 -* `.final_callback(void() function)`: Set the callback that runs at the end of all processing. This is the last thing that is executed before returning. See [Subcommand callbacks](#callbacks) for some additional details.  
630 -* `.immediate_callback()`: Specifies whether the callback for a subcommand should be run as a `parse_complete_callback`(true) or `final_callback`(false). When used on the main app it will execute the main app callback prior to the callbacks for a subcommand if they do not also have the `immediate_callback` flag set. It is preferable to use the `parse_complete_callback` or `final_callback` directly instead of the `callback` and `immediate_callback` if one wishes to control the ordering and timing of callback. Though `immediate_callback` can be used to swap them if that is needed.  
631 -* `.pre_parse_callback(void(std::size_t) function)`: Set a callback that executes after the first argument of an application is processed. See [Subcommand callbacks](#callbacks) for some additional details.  
632 -* `.allow_extras()`: Do not throw an error if extra arguments are left over.  
633 -* `.positionals_at_end()`: Specify that positional arguments occur as the last arguments and throw an error if an unexpected positional is encountered.  
634 -* `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app.  
635 -* `.footer(message)`: Set text to appear at the bottom of the help string.  
636 -* `.footer(std::string())`: Set a callback to generate a string that will appear at the end of the help string.  
637 -* `.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option.  
638 -* `.set_version_flag(name, versionString or callback, help_message)`: Set the version flag name and version string or callback and optional help message, returns a pointer to the created option.  
639 -* `.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands.  
640 -* `.failure_message(func)`: Set the failure message function. Two provided: `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default).  
641 -* `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` will be hide the subcommand.  
642 -* `[option_name]`: retrieve a const pointer to an option given by `option_name` for Example `app["--flag1"]` will get a pointer to the option for the "--flag1" value, `app["--flag1"]->as<bool>()` will get the results of the command line for a flag. The operation will throw an exception if the option name is not valid. 589 +- `.ignore_case()`: Ignore the case of this subcommand. Inherited by added subcommands, so is usually used on the main `App`.
  590 +- `.ignore_underscore()`: Ignore any underscores in the subcommand name. Inherited by added subcommands, so is usually used on the main `App`.
  591 +- `.allow_windows_style_options()`: Allow command line options to be parsed in the form of `/s /long /file:file_name.ext` This option does not change how options are specified in the `add_option` calls or the ability to process options in the form of `-s --long --file=file_name.ext`.
  592 +- `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent option. Subcommands always are allowed to "fall through" as in they will first attempt to match on the current subcommand and if they fail will progressively check parents for matching subcommands.
  593 +- `.configurable()`: Allow the subcommand to be triggered from a configuration file. By default subcommand options in a configuration file do not trigger a subcommand but will just update default values.
  594 +- `.disable()`: Specify that the subcommand is disabled, if given with a bool value it will enable or disable the subcommand or option group.
  595 +- `.disabled_by_default()`: Specify that at the start of parsing the subcommand/option_group should be disabled. This is useful for allowing some Subcommands to trigger others.
  596 +- `.enabled_by_default()`: Specify that at the start of each parse the subcommand/option_group should be enabled. This is useful for allowing some Subcommands to disable others.
  597 +- `.silent()`: Specify that the subcommand is silent meaning that if used it won't show up in the subcommand list. This allows the use of subcommands as modifiers
  598 +- `.validate_positionals()`: Specify that positionals should pass validation before matching. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional or extra arguments.
  599 +- `.validate_optional_arguments()`:๐Ÿ†• Specify that optional arguments should pass validation before being assigned to an option. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional subcommand or extra arguments.
  600 +- `.excludes(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, these subcommands cannot be given together. In the case of options, if the option is passed the subcommand cannot be used and will generate an error.
  601 +- `.needs(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, the subcommands will require the given option to have been given before this subcommand is validated which occurs prior to execution of any callback or after parsing is completed.
  602 +- `.require_option()`: Require 1 or more options or option groups be used.
  603 +- `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.
  604 +- `.require_option(min, max)`: Explicitly set min and max allowed options or option groups. Setting `max` to 0 implies unlimited options.
  605 +- `.require_subcommand()`: Require 1 or more subcommands.
  606 +- `.require_subcommand(N)`: Require `N` subcommands if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.
  607 +- `.require_subcommand(min, max)`: Explicitly set min and max allowed subcommands. Setting `max` to 0 is unlimited.
  608 +- `.add_subcommand(name="", description="")`: Add a subcommand, returns a pointer to the internally stored subcommand.
  609 +- `.add_subcommand(shared_ptr<App>)`: Add a subcommand by shared_ptr, returns a pointer to the internally stored subcommand.
  610 +- `.remove_subcommand(App)`: Remove a subcommand from the app or subcommand.
  611 +- `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on the command line.
  612 +- `.get_subcommands(filter)`: The list of subcommands that match a particular filter function.
  613 +- `.add_option_group(name="", description="")`: Add an [option group](#option-groups) to an App, an option group is specialized subcommand intended for containing groups of options or other groups for controlling how options interact.
  614 +- `.get_parent()`: Get the parent App or `nullptr` if called on main App.
  615 +- `.get_option(name)`: Get an option pointer by option name will throw if the specified option is not available, nameless subcommands are also searched
  616 +- `.get_option_no_throw(name)`: Get an option pointer by option name. This function will return a `nullptr` instead of throwing if the option is not available.
  617 +- `.get_options(filter)`: Get the list of all defined option pointers (useful for processing the app for custom output formats).
  618 +- `.parse_order()`: Get the list of option pointers in the order they were parsed (including duplicates).
  619 +- `.formatter(fmt)`: Set a formatter, with signature `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more details.
  620 +- `.description(str)`: Set/change the description.
  621 +- `.get_description()`: Access the description.
  622 +- `.alias(str)`: set an alias for the subcommand, this allows subcommands to be called by more than one name.
  623 +- `.parsed()`: True if this subcommand was given on the command line.
  624 +- `.count()`: Returns the number of times the subcommand was called.
  625 +- `.count(option_name)`: Returns the number of times a particular option was called.
  626 +- `.count_all()`: Returns the total number of arguments a particular subcommand processed, on the main App it returns the total number of processed commands.
  627 +- `.name(name)`: Add or change the name.
  628 +- `.callback(void() function)`: Set the callback for an app. Either sets the `pre_parse_callback` or the `final_callback` depending on the value of `immediate_callback`. See [Subcommand callbacks](#callbacks) for some additional details.
  629 +- `.parse_complete_callback(void() function)`: Set the callback that runs at the completion of parsing. For subcommands this is executed at the completion of the single subcommand and can be executed multiple times. See [Subcommand callbacks](#callbacks) for some additional details.
  630 +- `.final_callback(void() function)`: Set the callback that runs at the end of all processing. This is the last thing that is executed before returning. See [Subcommand callbacks](#callbacks) for some additional details.
  631 +- `.immediate_callback()`: Specifies whether the callback for a subcommand should be run as a `parse_complete_callback`(true) or `final_callback`(false). When used on the main app it will execute the main app callback prior to the callbacks for a subcommand if they do not also have the `immediate_callback` flag set. It is preferable to use the `parse_complete_callback` or `final_callback` directly instead of the `callback` and `immediate_callback` if one wishes to control the ordering and timing of callback. Though `immediate_callback` can be used to swap them if that is needed.
  632 +- `.pre_parse_callback(void(std::size_t) function)`: Set a callback that executes after the first argument of an application is processed. See [Subcommand callbacks](#callbacks) for some additional details.
  633 +- `.allow_extras()`: Do not throw an error if extra arguments are left over.
  634 +- `.positionals_at_end()`: Specify that positional arguments occur as the last arguments and throw an error if an unexpected positional is encountered.
  635 +- `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app.
  636 +- `.footer(message)`: Set text to appear at the bottom of the help string.
  637 +- `.footer(std::string())`: Set a callback to generate a string that will appear at the end of the help string.
  638 +- `.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option.
  639 +- `.set_version_flag(name, versionString or callback, help_message)`: Set the version flag name and version string or callback and optional help message, returns a pointer to the created option.
  640 +- `.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands.
  641 +- `.failure_message(func)`: Set the failure message function. Two provided: `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default).
  642 +- `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` will be hide the subcommand.
  643 +- `[option_name]`: retrieve a const pointer to an option given by `option_name` for Example `app["--flag1"]` will get a pointer to the option for the "--flag1" value, `app["--flag1"]->as<bool>()` will get the results of the command line for a flag. The operation will throw an exception if the option name is not valid.
643 644
644 > Note: if you have a fixed number of required positional options, that will match before subcommand names. `{}` is an empty filter function, and any positional argument will match before repeated subcommand names. 645 > Note: if you have a fixed number of required positional options, that will match before subcommand names. `{}` is an empty filter function, and any positional argument will match before repeated subcommand names.
645 646
646 #### Callbacks 647 #### Callbacks
647 648
648 -A subcommand has three optional callbacks that are executed at different stages of processing. The `preparse_callback` is executed once after the first argument of a subcommand or application is processed and gives an argument for the number of remaining arguments to process. For the main app the first argument is considered the program name, for subcommands the first argument is the subcommand name. For Option groups and nameless subcommands the first argument is after the first argument or subcommand is processed from that group.  
649 -The second callback is executed after parsing. This is known as the `parse_complete_callback`. For subcommands this is executed immediately after parsing and can be executed multiple times if a subcommand is called multiple times. On the main app this callback is executed after all the `parse_complete_callback`s for the subcommands are executed but prior to any `final_callback` calls in the subcommand or option groups. If the main app or subcommand has a config file, no data from the config file will be reflected in `parse_complete_callback` on named subcommands. For `option_group`s the `parse_complete_callback` is executed prior to the `parse_complete_callback` on the main app but after the `config_file` is loaded (if specified). The `final_callback` is executed after all processing is complete. After the `parse_complete_callback` is executed on the main app, the used subcommand `final_callback` are executed followed by the "final callback" for option groups. The last thing to execute is the `final_callback` for the `main_app`. 649 +A subcommand has three optional callbacks that are executed at different stages of processing. The `preparse_callback` is executed once after the first argument of a subcommand or application is processed and gives an argument for the number of remaining arguments to process. For the main app the first argument is considered the program name, for subcommands the first argument is the subcommand name. For Option groups and nameless subcommands the first argument is after the first argument or subcommand is processed from that group.
  650 +The second callback is executed after parsing. This is known as the `parse_complete_callback`. For subcommands this is executed immediately after parsing and can be executed multiple times if a subcommand is called multiple times. On the main app this callback is executed after all the `parse_complete_callback`s for the subcommands are executed but prior to any `final_callback` calls in the subcommand or option groups. If the main app or subcommand has a config file, no data from the config file will be reflected in `parse_complete_callback` on named subcommands. For `option_group`s the `parse_complete_callback` is executed prior to the `parse_complete_callback` on the main app but after the `config_file` is loaded (if specified). The `final_callback` is executed after all processing is complete. After the `parse_complete_callback` is executed on the main app, the used subcommand `final_callback` are executed followed by the "final callback" for option groups. The last thing to execute is the `final_callback` for the `main_app`.
650 For example say an application was set up like 651 For example say an application was set up like
651 652
652 ```cpp 653 ```cpp
@@ -665,14 +666,14 @@ Then the command line is given as @@ -665,14 +666,14 @@ Then the command line is given as
665 program --opt1 opt1_val sub1 --sub1opt --sub1optb val sub2 --sub2opt sub1 --sub1opt2 sub2 --sub2opt2 val 666 program --opt1 opt1_val sub1 --sub1opt --sub1optb val sub2 --sub2opt sub1 --sub1opt2 sub2 --sub2opt2 val
666 ``` 667 ```
667 668
668 -* `pa` will be called prior to parsing any values with an argument of 13.  
669 -* `pc1` will be called immediately after processing the `sub1` command with a value of 10.  
670 -* `c1` will be called when the `sub2` command is encountered.  
671 -* `pc2` will be called with value of 6 after the `sub2` command is encountered.  
672 -* `c1` will be called again after the second `sub2` command is encountered.  
673 -* `ac1` will be called after processing of all arguments  
674 -* `c2` will be called once after processing all arguments.  
675 -* `ac2` will be called last after completing all lower level callbacks have been executed. 669 +- `pa` will be called prior to parsing any values with an argument of 13.
  670 +- `pc1` will be called immediately after processing the `sub1` command with a value of 10.
  671 +- `c1` will be called when the `sub2` command is encountered.
  672 +- `pc2` will be called with value of 6 after the `sub2` command is encountered.
  673 +- `c1` will be called again after the second `sub2` command is encountered.
  674 +- `ac1` will be called after processing of all arguments
  675 +- `c2` will be called once after processing all arguments.
  676 +- `ac2` will be called last after completing all lower level callbacks have been executed.
676 677
677 A subcommand is considered terminated when one of the following conditions are met. 678 A subcommand is considered terminated when one of the following conditions are met.
678 679
@@ -681,7 +682,7 @@ A subcommand is considered terminated when one of the following conditions are m @@ -681,7 +682,7 @@ A subcommand is considered terminated when one of the following conditions are m
681 3. The `positional_mark` (`--`) is encountered and there are no available positional slots in the subcommand. 682 3. The `positional_mark` (`--`) is encountered and there are no available positional slots in the subcommand.
682 4. The `subcommand_terminator` mark (`++`) is encountered 683 4. The `subcommand_terminator` mark (`++`) is encountered
683 684
684 -Prior to executed a `parse_complete_callback` all contained options are processed before the callback is triggered. If a subcommand with a `parse_complete_callback` is called again, then the contained options are reset, and can be triggered again. 685 +Prior to executed a `parse_complete_callback` all contained options are processed before the callback is triggered. If a subcommand with a `parse_complete_callback` is called again, then the contained options are reset, and can be triggered again.
685 686
686 #### Option groups 687 #### Option groups
687 688
@@ -691,7 +692,7 @@ The subcommand method @@ -691,7 +692,7 @@ The subcommand method
691 .add_option_group(name,description) 692 .add_option_group(name,description)
692 ``` 693 ```
693 694
694 -Will create an option group, and return a pointer to it. The argument for `description` is optional and can be omitted. An option group allows creation of a collection of options, similar to the groups function on options, but with additional controls and requirements. They allow specific sets of options to be composed and controlled as a collective. For an example see [range example](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp). Option groups are a specialization of an App so all [functions](#subcommand-options) that work with an App or subcommand also work on option groups. Options can be created as part of an option group using the add functions just like a subcommand, or previously created options can be added through. The name given in an option group must not contain newlines or null characters. 695 +Will create an option group, and return a pointer to it. The argument for `description` is optional and can be omitted. An option group allows creation of a collection of options, similar to the groups function on options, but with additional controls and requirements. They allow specific sets of options to be composed and controlled as a collective. For an example see [range example](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp). Option groups are a specialization of an App so all [functions](#subcommand-options) that work with an App or subcommand also work on option groups. Options can be created as part of an option group using the add functions just like a subcommand, or previously created options can be added through. The name given in an option group must not contain newlines or null characters.
695 696
696 ```cpp 697 ```cpp
697 ogroup->add_option(option_pointer); 698 ogroup->add_option(option_pointer);
@@ -699,7 +700,7 @@ ogroup-&gt;add_options(option_pointer); @@ -699,7 +700,7 @@ ogroup-&gt;add_options(option_pointer);
699 ogroup->add_options(option1,option2,option3,...); 700 ogroup->add_options(option1,option2,option3,...);
700 ``` 701 ```
701 702
702 -The option pointers used in this function must be options defined in the parent application of the option group otherwise an error will be generated. Subcommands can also be added via 703 +The option pointers used in this function must be options defined in the parent application of the option group otherwise an error will be generated. Subcommands can also be added via
703 704
704 ```cpp 705 ```cpp
705 ogroup->add_subcommand(subcom_pointer); 706 ogroup->add_subcommand(subcom_pointer);
@@ -707,8 +708,8 @@ ogroup-&gt;add_subcommand(subcom_pointer); @@ -707,8 +708,8 @@ ogroup-&gt;add_subcommand(subcom_pointer);
707 708
708 This results in the subcommand being moved from its parent into the option group. 709 This results in the subcommand being moved from its parent into the option group.
709 710
710 -Options in an option group are searched for a command line match after any options in the main app, so any positionals in the main app would be matched first. So care must be taken to make sure of the order when using positional arguments and option groups.  
711 -Option groups work well with `excludes` and `require_options` methods, as an application will treat an option group as a single option for the purpose of counting and requirements, and an option group will be considered used if any of the options or subcommands contained in it are used. Option groups allow specifying requirements such as requiring 1 of 3 options in one group and 1 of 3 options in a different group. Option groups can contain other groups as well. Disabling an option group will turn off all options within the group. 711 +Options in an option group are searched for a command line match after any options in the main app, so any positionals in the main app would be matched first. So care must be taken to make sure of the order when using positional arguments and option groups.
  712 +Option groups work well with `excludes` and `require_options` methods, as an application will treat an option group as a single option for the purpose of counting and requirements, and an option group will be considered used if any of the options or subcommands contained in it are used. Option groups allow specifying requirements such as requiring 1 of 3 options in one group and 1 of 3 options in a different group. Option groups can contain other groups as well. Disabling an option group will turn off all options within the group.
712 713
713 The `CLI::TriggerOn` and `CLI::TriggerOff` methods are helper functions to allow the use of options/subcommands from one group to trigger another group on or off. 714 The `CLI::TriggerOn` and `CLI::TriggerOff` methods are helper functions to allow the use of options/subcommands from one group to trigger another group on or off.
714 715
@@ -717,7 +718,7 @@ CLI::TriggerOn(group1_pointer, triggered_group); @@ -717,7 +718,7 @@ CLI::TriggerOn(group1_pointer, triggered_group);
717 CLI::TriggerOff(group2_pointer, disabled_group); 718 CLI::TriggerOff(group2_pointer, disabled_group);
718 ``` 719 ```
719 720
720 -These functions make use of `preparse_callback`, `enabled_by_default()` and `disabled_by_default`. The triggered group may be a vector of group pointers. These methods should only be used once per group and will override any previous use of the underlying functions. More complex arrangements can be accomplished using similar methodology with a custom `preparse_callback` function that does more. 721 +These functions make use of `preparse_callback`, `enabled_by_default()` and `disabled_by_default`. The triggered group may be a vector of group pointers. These methods should only be used once per group and will override any previous use of the underlying functions. More complex arrangements can be accomplished using similar methodology with a custom `preparse_callback` function that does more.
721 722
722 Additional helper functions `deprecate_option` and `retire_option` are available to deprecate or retire options 723 Additional helper functions `deprecate_option` and `retire_option` are available to deprecate or retire options
723 724
@@ -726,16 +727,16 @@ CLI::deprecate_option(option *, replacement_name=&quot;&quot;); @@ -726,16 +727,16 @@ CLI::deprecate_option(option *, replacement_name=&quot;&quot;);
726 CLI::deprecate_option(App,option_name,replacement_name=""); 727 CLI::deprecate_option(App,option_name,replacement_name="");
727 ``` 728 ```
728 729
729 -will specify that the option is deprecated which will display a message in the help and a warning on first usage. Deprecated options function normally but will add a message in the help and display a warning on first use. 730 +will specify that the option is deprecated which will display a message in the help and a warning on first usage. Deprecated options function normally but will add a message in the help and display a warning on first use.
730 731
731 ```cpp 732 ```cpp
732 CLI::retire_option(App,option *); 733 CLI::retire_option(App,option *);
733 CLI::retire_option(App,option_name); 734 CLI::retire_option(App,option_name);
734 ``` 735 ```
735 736
736 -will create an option that does nothing by default and will display a warning on first usage that the option is retired and has no effect. If the option exists it is replaces with a dummy option that takes the same arguments. 737 +will create an option that does nothing by default and will display a warning on first usage that the option is retired and has no effect. If the option exists it is replaces with a dummy option that takes the same arguments.
737 738
738 -If an empty string is passed the option group name the entire group will be hidden in the help results. For example. 739 +If an empty string is passed the option group name the entire group will be hidden in the help results. For example.
739 740
740 ```cpp 741 ```cpp
741 auto hidden_group=app.add_option_group(""); 742 auto hidden_group=app.add_option_group("");
@@ -786,22 +787,22 @@ in_subcommand = Wow @@ -786,22 +787,22 @@ in_subcommand = Wow
786 sub.subcommand = true 787 sub.subcommand = true
787 ``` 788 ```
788 789
789 -Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults"). You cannot set positional-only arguments. Subcommands can be triggered from configuration files if the `configurable` flag was set on the subcommand. Then the use of `[subcommand]` notation will trigger a subcommand and cause it to act as if it were on the command line. 790 +Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults"). You cannot set positional-only arguments. Subcommands can be triggered from configuration files if the `configurable` flag was set on the subcommand. Then the use of `[subcommand]` notation will trigger a subcommand and cause it to act as if it were on the command line.
790 791
791 To print a configuration file from the passed 792 To print a configuration file from the passed
792 -arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include the app and option descriptions. See [Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for some additional details and customization points. 793 +arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include the app and option descriptions. See [Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for some additional details and customization points.
793 794
794 -If it is desired that multiple configuration be allowed. Use 795 +If it is desired that multiple configuration be allowed. Use
795 796
796 ```cpp 797 ```cpp
797 app.set_config("--config")->expected(1, X); 798 app.set_config("--config")->expected(1, X);
798 ``` 799 ```
799 800
800 -Where X is some positive number and will allow up to `X` configuration files to be specified by separate `--config` arguments. Value strings with quote characters in it will be printed with a single quote. All other arguments will use double quote. Empty strings will use a double quoted argument. Numerical or boolean values are not quoted. 801 +Where X is some positive number and will allow up to `X` configuration files to be specified by separate `--config` arguments. Value strings with quote characters in it will be printed with a single quote. All other arguments will use double quote. Empty strings will use a double quoted argument. Numerical or boolean values are not quoted.
801 802
802 -For options or flags which allow 0 arguments to be passed using an empty string in the config file, `{}`, or `[]` will convert the result to the default value specified via `default_str` or `default_val` on the option ๐Ÿ†•. If no user specified default is given the result is an empty string or the converted value of an empty string. 803 +For options or flags which allow 0 arguments to be passed using an empty string in the config file, `{}`, or `[]` will convert the result to the default value specified via `default_str` or `default_val` on the option ๐Ÿ†•. If no user specified default is given the result is an empty string or the converted value of an empty string.
803 804
804 -NOTE: Transforms and checks can be used with the option pointer returned from set_config like any other option to validate the input if needed. It can also be used with the built in transform `CLI::FileOnDefaultPath` to look in a default path as well as the current one. For example 805 +NOTE: Transforms and checks can be used with the option pointer returned from set_config like any other option to validate the input if needed. It can also be used with the built in transform `CLI::FileOnDefaultPath` to look in a default path as well as the current one. For example
805 806
806 ```cpp 807 ```cpp
807 app.set_config("--config")->transform(CLI::FileOnDefaultPath("/to/default/path/")); 808 app.set_config("--config")->transform(CLI::FileOnDefaultPath("/to/default/path/"));
@@ -838,7 +839,7 @@ but before run behavior, while @@ -838,7 +839,7 @@ but before run behavior, while
838 still giving the user freedom to `callback` on the main app. 839 still giving the user freedom to `callback` on the main app.
839 840
840 The most important parse function is `parse(std::vector<std::string>)`, which takes a reversed list of arguments (so that `pop_back` processes the args in the correct order). `get_help_ptr` and `get_config_ptr` give you access to the help/config option pointers. The standard `parse` manually sets the name from the first argument, so it should not be in this vector. You can also use `parse(string, bool)` to split up and parse a single string; the optional boolean should be set to true if you are 841 The most important parse function is `parse(std::vector<std::string>)`, which takes a reversed list of arguments (so that `pop_back` processes the args in the correct order). `get_help_ptr` and `get_config_ptr` give you access to the help/config option pointers. The standard `parse` manually sets the name from the first argument, so it should not be in this vector. You can also use `parse(string, bool)` to split up and parse a single string; the optional boolean should be set to true if you are
841 -including the program name in the string, and false otherwise. The program name can contain spaces if it is an existing file, otherwise can be enclosed in quotes(single quote, double quote or backtick). Embedded quote characters can be escaped with `-including the program name in the string, and false otherwise. The program name can contain spaces if it is an existing file, otherwise can be enclosed in quotes(single quote, double quote or backtick). . 842 +including the program name in the string, and false otherwise. The program name can contain spaces if it is an existing file, otherwise can be enclosed in quotes(single quote, double quote or backtick). Embedded quote characters can be escaped with `+including the program name in the string, and false otherwise. The program name can contain spaces if it is an existing file, otherwise can be enclosed in quotes(single quote, double quote or backtick)..
842 843
843 Also, in a related note, the `App` you get a pointer to is stored in the parent `App` in a `shared_ptr`s (similar to `Option`s) and are deleted when the main `App` goes out of scope unless the object has another owner. 844 Also, in a related note, the `App` you get a pointer to is stored in the parent `App` in a `shared_ptr`s (similar to `Option`s) and are deleted when the main `App` goes out of scope unless the object has another owner.
844 845
@@ -920,35 +921,35 @@ The API is [documented here][api-docs]. Also see the [CLI11 tutorial GitBook][gi @@ -920,35 +921,35 @@ The API is [documented here][api-docs]. Also see the [CLI11 tutorial GitBook][gi
920 921
921 Several short examples of different features are included in the repository. A brief description of each is included here 922 Several short examples of different features are included in the repository. A brief description of each is included here
922 923
923 -* [callback_passthrough](https://github.com/CLIUtils/CLI11/blob/main/examples/callback_passthrough.cpp): Example of directly passing remaining arguments through to a callback function which generates a CLI11 application based on existing arguments.  
924 -* [custom_parse](https://github.com/CLIUtils/CLI11/blob/main/examples/custom_parse.cpp): Based on [Issue #566](https://github.com/CLIUtils/CLI11/issues/566), example of custom parser  
925 -* [digit_args](https://github.com/CLIUtils/CLI11/blob/main/examples/digit_args.cpp): Based on [Issue #123](https://github.com/CLIUtils/CLI11/issues/123), uses digit flags to pass a value  
926 -* [enum](https://github.com/CLIUtils/CLI11/blob/main/examples/enum.cpp): Using enumerations in an option, and the use of [CheckedTransformer](#transforming-validators)  
927 -* [enum_ostream](https://github.com/CLIUtils/CLI11/blob/main/examples/enum_ostream.cpp): In addition to the contents of example enum.cpp, this example shows how a custom ostream operator overrides CLI11's enum streaming.  
928 -* [formatter](https://github.com/CLIUtils/CLI11/blob/main/examples/formatter.cpp): Illustrating usage of a custom formatter  
929 -* [groups](https://github.com/CLIUtils/CLI11/blob/main/examples/groups.cpp): Example using groups of options for help grouping and a the timer helper class  
930 -* [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/main/examples/inter_argument_order.cpp): An app to practice mixing unlimited arguments, but still recover the original order.  
931 -* [json](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp): Using JSON as a config file parser  
932 -* [modhelp](https://github.com/CLIUtils/CLI11/blob/main/examples/modhelp.cpp): How to modify the help flag to do something other than default  
933 -* [nested](https://github.com/CLIUtils/CLI11/blob/main/examples/nested.cpp): Nested subcommands  
934 -* [option_groups](https://github.com/CLIUtils/CLI11/blob/main/examples/option_groups.cpp): Illustrating the use of option groups and a required number of options. Based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) to set interacting groups of options  
935 -* [positional_arity](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_arity.cpp): Illustrating use of `preparse_callback` to handle situations where the number of arguments can determine which should get parsed, Based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)  
936 -* [positional_validation](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_validation.cpp): Example of how positional arguments are validated using the `validate_positional` flag, also based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)  
937 -* [prefix_command](https://github.com/CLIUtils/CLI11/blob/main/examples/prefix_command.cpp): Illustrating use of the `prefix_command` flag.  
938 -* [ranges](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp): App to demonstrate exclusionary option groups based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88)  
939 -* [shapes](https://github.com/CLIUtils/CLI11/blob/main/examples/shapes.cpp): Illustrating how to set up repeated subcommands Based on [gitter discussion](https://gitter.im/CLI11gitter/Lobby?at=5c7af6b965ffa019ea788cd5)  
940 -* [simple](https://github.com/CLIUtils/CLI11/blob/main/examples/simple.cpp): A simple example of how to set up a CLI11 Application with different flags and options  
941 -* [subcom_help](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_help.cpp): Configuring help for subcommands  
942 -* [subcom_partitioned](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_partitioned.cpp): Example with a timer and subcommands generated separately and added to the main app later.  
943 -* [subcommands](https://github.com/CLIUtils/CLI11/blob/main/examples/subcommands.cpp): Short example of subcommands  
944 -* [validators](https://github.com/CLIUtils/CLI11/blob/main/examples/validators.cpp): Example illustrating use of validators 924 +- [callback_passthrough](https://github.com/CLIUtils/CLI11/blob/main/examples/callback_passthrough.cpp): Example of directly passing remaining arguments through to a callback function which generates a CLI11 application based on existing arguments.
  925 +- [custom_parse](https://github.com/CLIUtils/CLI11/blob/main/examples/custom_parse.cpp): Based on [Issue #566](https://github.com/CLIUtils/CLI11/issues/566), example of custom parser
  926 +- [digit_args](https://github.com/CLIUtils/CLI11/blob/main/examples/digit_args.cpp): Based on [Issue #123](https://github.com/CLIUtils/CLI11/issues/123), uses digit flags to pass a value
  927 +- [enum](https://github.com/CLIUtils/CLI11/blob/main/examples/enum.cpp): Using enumerations in an option, and the use of [CheckedTransformer](#transforming-validators)
  928 +- [enum_ostream](https://github.com/CLIUtils/CLI11/blob/main/examples/enum_ostream.cpp): In addition to the contents of example enum.cpp, this example shows how a custom ostream operator overrides CLI11's enum streaming.
  929 +- [formatter](https://github.com/CLIUtils/CLI11/blob/main/examples/formatter.cpp): Illustrating usage of a custom formatter
  930 +- [groups](https://github.com/CLIUtils/CLI11/blob/main/examples/groups.cpp): Example using groups of options for help grouping and a the timer helper class
  931 +- [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/main/examples/inter_argument_order.cpp): An app to practice mixing unlimited arguments, but still recover the original order.
  932 +- [json](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp): Using JSON as a config file parser
  933 +- [modhelp](https://github.com/CLIUtils/CLI11/blob/main/examples/modhelp.cpp): How to modify the help flag to do something other than default
  934 +- [nested](https://github.com/CLIUtils/CLI11/blob/main/examples/nested.cpp): Nested subcommands
  935 +- [option_groups](https://github.com/CLIUtils/CLI11/blob/main/examples/option_groups.cpp): Illustrating the use of option groups and a required number of options. Based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) to set interacting groups of options
  936 +- [positional_arity](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_arity.cpp): Illustrating use of `preparse_callback` to handle situations where the number of arguments can determine which should get parsed, Based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)
  937 +- [positional_validation](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_validation.cpp): Example of how positional arguments are validated using the `validate_positional` flag, also based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)
  938 +- [prefix_command](https://github.com/CLIUtils/CLI11/blob/main/examples/prefix_command.cpp): Illustrating use of the `prefix_command` flag.
  939 +- [ranges](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp): App to demonstrate exclusionary option groups based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88)
  940 +- [shapes](https://github.com/CLIUtils/CLI11/blob/main/examples/shapes.cpp): Illustrating how to set up repeated subcommands Based on [gitter discussion](https://gitter.im/CLI11gitter/Lobby?at=5c7af6b965ffa019ea788cd5)
  941 +- [simple](https://github.com/CLIUtils/CLI11/blob/main/examples/simple.cpp): A simple example of how to set up a CLI11 Application with different flags and options
  942 +- [subcom_help](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_help.cpp): Configuring help for subcommands
  943 +- [subcom_partitioned](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_partitioned.cpp): Example with a timer and subcommands generated separately and added to the main app later.
  944 +- [subcommands](https://github.com/CLIUtils/CLI11/blob/main/examples/subcommands.cpp): Short example of subcommands
  945 +- [validators](https://github.com/CLIUtils/CLI11/blob/main/examples/validators.cpp): Example illustrating use of validators
945 946
946 ## Contribute 947 ## Contribute
947 948
948 To contribute, open an [issue][github issues] or [pull request][github pull requests] on GitHub, or ask a question on [gitter][]. There is also a short note to contributors [here](./.github/CONTRIBUTING.md). 949 To contribute, open an [issue][github issues] or [pull request][github pull requests] on GitHub, or ask a question on [gitter][]. There is also a short note to contributors [here](./.github/CONTRIBUTING.md).
949 This readme roughly follows the [Standard Readme Style][] and includes a mention of almost every feature of the library. More complex features are documented in more detail in the [CLI11 tutorial GitBook][gitbook]. 950 This readme roughly follows the [Standard Readme Style][] and includes a mention of almost every feature of the library. More complex features are documented in more detail in the [CLI11 tutorial GitBook][gitbook].
950 951
951 -This project was created by [Henry Schreiner](https://github.com/henryiii) and major features were added by [Philip Top](https://github.com/phlptp). Special thanks to all the contributors ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 952 +This project was created by [Henry Schreiner](https://github.com/henryiii) and major features were added by [Philip Top](https://github.com/phlptp). Special thanks to all the contributors ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
952 953
953 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> 954 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
954 <!-- prettier-ignore-start --> 955 <!-- prettier-ignore-start -->
@@ -1024,6 +1025,7 @@ This project was created by [Henry Schreiner](https://github.com/henryiii) and m @@ -1024,6 +1025,7 @@ This project was created by [Henry Schreiner](https://github.com/henryiii) and m
1024 1025
1025 <!-- markdownlint-enable --> 1026 <!-- markdownlint-enable -->
1026 <!-- prettier-ignore-end --> 1027 <!-- prettier-ignore-end -->
  1028 +
1027 <!-- ALL-CONTRIBUTORS-LIST:END --> 1029 <!-- ALL-CONTRIBUTORS-LIST:END -->
1028 1030
1029 This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 1031 This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -1093,7 +1095,7 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi @@ -1093,7 +1095,7 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi
1093 [cli]: https://codesynthesis.com/projects/cli/ 1095 [cli]: https://codesynthesis.com/projects/cli/
1094 [single file libs]: https://github.com/nothings/single_file_libs/blob/master/README.md 1096 [single file libs]: https://github.com/nothings/single_file_libs/blob/master/README.md
1095 [codacy-badge]: https://app.codacy.com/project/badge/Grade/2796b969c1b54321a02ad08affec0800 1097 [codacy-badge]: https://app.codacy.com/project/badge/Grade/2796b969c1b54321a02ad08affec0800
1096 -[codacy-link]: https://www.codacy.com/gh/CLIUtils/CLI11/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=CLIUtils/CLI11&amp;utm_campaign=Badge_Grade 1098 +[codacy-link]: https://www.codacy.com/gh/CLIUtils/CLI11/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CLIUtils/CLI11&utm_campaign=Badge_Grade
1097 [hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html 1099 [hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html
1098 [standard readme style]: https://github.com/RichardLitt/standard-readme 1100 [standard readme style]: https://github.com/RichardLitt/standard-readme
1099 [argparse]: https://github.com/p-ranav/argparse 1101 [argparse]: https://github.com/p-ranav/argparse
azure-pipelines.yml
@@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
4 # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc 4 # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
5 5
6 trigger: 6 trigger:
7 -- main  
8 -- 'v*' 7 + - main
  8 + - "v*"
9 9
10 pr: 10 pr:
11 -- main  
12 -- 'v*' 11 + - main
  12 + - "v*"
13 13
14 variables: 14 variables:
15 cli11.single: ON 15 cli11.single: ON
@@ -19,122 +19,121 @@ variables: @@ -19,122 +19,121 @@ variables:
19 CMAKE_BUILD_PARALLEL_LEVEL: 4 19 CMAKE_BUILD_PARALLEL_LEVEL: 4
20 20
21 jobs: 21 jobs:
  22 + - job: ClangTidy
  23 + variables:
  24 + CXX_FLAGS: "-Werror -Wcast-align -Wfloat-equal -Wimplicit-atomic-properties -Wmissing-declarations -Woverlength-strings -Wshadow -Wstrict-selector-match -Wundeclared-selector -Wunreachable-code -std=c++11"
  25 + cli11.options: -DCLI11_CLANG_TIDY=ON -DCLI11_CLANG_TIDY_OPTIONS="-fix"
  26 + cli11.std: 11
  27 + cli11.single: OFF
  28 + CMAKE_BUILD_PARALLEL_LEVEL: 1
  29 + pool:
  30 + vmImage: "ubuntu-latest"
  31 + container: silkeh/clang:8
  32 + steps:
  33 + - template: .ci/azure-cmake.yml
  34 + - template: .ci/azure-build.yml
  35 + - script: git diff --exit-code --color
  36 + displayName: Check tidy
22 37
23 -- job: ClangTidy  
24 - variables:  
25 - CXX_FLAGS: "-Werror -Wcast-align -Wfloat-equal -Wimplicit-atomic-properties -Wmissing-declarations -Woverlength-strings -Wshadow -Wstrict-selector-match -Wundeclared-selector -Wunreachable-code -std=c++11"  
26 - cli11.options: -DCLI11_CLANG_TIDY=ON -DCLI11_CLANG_TIDY_OPTIONS="-fix"  
27 - cli11.std: 11  
28 - cli11.single: OFF  
29 - CMAKE_BUILD_PARALLEL_LEVEL: 1  
30 - pool:  
31 - vmImage: 'ubuntu-latest'  
32 - container: silkeh/clang:8  
33 - steps:  
34 - - template: .ci/azure-cmake.yml  
35 - - template: .ci/azure-build.yml  
36 - - script: git diff --exit-code --color  
37 - displayName: Check tidy 38 + - job: CppLint
  39 + pool:
  40 + vmImage: "ubuntu-latest"
  41 + container: sharaku/cpplint:latest
  42 + steps:
  43 + - bash: cpplint --counting=detailed --recursive examples include/CLI tests
  44 + displayName: Checking against google style guide
38 45
39 -- job: CppLint  
40 - pool:  
41 - vmImage: 'ubuntu-latest'  
42 - container: sharaku/cpplint:latest  
43 - steps:  
44 - - bash: cpplint --counting=detailed --recursive examples include/CLI tests  
45 - displayName: Checking against google style guide 46 + # TODO: Fix macOS error and windows warning in c++17 mode
  47 + - job: Native
  48 + strategy:
  49 + matrix:
  50 + Linux14:
  51 + vmImage: "ubuntu-latest"
  52 + macOS17:
  53 + vmImage: "macOS-latest"
  54 + cli11.std: 17
  55 + macOS11:
  56 + vmImage: "macOS-latest"
  57 + cli11.std: 11
  58 + Windows17:
  59 + vmImage: "vs2017-win2016"
  60 + cli11.std: 17
  61 + Windows11:
  62 + vmImage: "vs2017-win2016"
  63 + cli11.std: 11
  64 + Windowslatest:
  65 + vmImage: "windows-2019"
  66 + cli11.std: 20
  67 + cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc"
  68 + Linux17nortti:
  69 + vmImage: "ubuntu-latest"
  70 + cli11.std: 17
  71 + cli11.options: -DCMAKE_CXX_FLAGS="-fno-rtti"
  72 + pool:
  73 + vmImage: $(vmImage)
  74 + steps:
  75 + - template: .ci/azure-build.yml
  76 + - template: .ci/azure-test.yml
46 77
47 -# TODO: Fix macOS error and windows warning in c++17 mode  
48 -- job: Native  
49 - strategy:  
50 - matrix:  
51 - Linux14:  
52 - vmImage: 'ubuntu-latest'  
53 - macOS17:  
54 - vmImage: 'macOS-latest'  
55 - cli11.std: 17  
56 - macOS11:  
57 - vmImage: 'macOS-latest'  
58 - cli11.std: 11  
59 - Windows17:  
60 - vmImage: 'vs2017-win2016'  
61 - cli11.std: 17  
62 - Windows11:  
63 - vmImage: 'vs2017-win2016'  
64 - cli11.std: 11  
65 - Windowslatest:  
66 - vmImage: 'windows-2019'  
67 - cli11.std: 20  
68 - cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc"  
69 - Linux17nortti:  
70 - vmImage: 'ubuntu-latest'  
71 - cli11.std: 17  
72 - cli11.options: -DCMAKE_CXX_FLAGS="-fno-rtti"  
73 - pool:  
74 - vmImage: $(vmImage)  
75 - steps:  
76 - - template: .ci/azure-build.yml  
77 - - template: .ci/azure-test.yml 78 + - job: Meson
  79 + pool:
  80 + vmImage: "ubuntu-latest"
  81 + steps:
  82 + - task: UsePythonVersion@0
  83 + inputs:
  84 + versionSpec: "3.7"
  85 + - script: python3 -m pip install meson ninja
  86 + displayName: install meson
  87 + - script: mkdir tests/mesonTest/subprojects
  88 + displayName: generate test directories
  89 + - script: ln -s "$(pwd)" tests/mesonTest/subprojects/CLI11
  90 + displayName: generate CLI11 symlink
  91 + - script: meson build
  92 + displayName: Run meson to generate build
  93 + workingDirectory: tests/mesonTest
  94 + - script: ninja -C tests/mesonTest/build
  95 + displayName: Build with Ninja
  96 + - script: ./tests/mesonTest/build/main --help
  97 + displayName: Run help
78 98
79 -- job: Meson  
80 - pool:  
81 - vmImage: 'ubuntu-latest'  
82 - steps:  
83 - - task: UsePythonVersion@0  
84 - inputs:  
85 - versionSpec: '3.7'  
86 - - script: python3 -m pip install meson ninja  
87 - displayName: install meson  
88 - - script: mkdir tests/mesonTest/subprojects  
89 - displayName: generate test directories  
90 - - script: ln -s "$(pwd)" tests/mesonTest/subprojects/CLI11  
91 - displayName: generate CLI11 symlink  
92 - - script: meson build  
93 - displayName: Run meson to generate build  
94 - workingDirectory: tests/mesonTest  
95 - - script: ninja -C tests/mesonTest/build  
96 - displayName: Build with Ninja  
97 - - script: ./tests/mesonTest/build/main --help  
98 - displayName: Run help  
99 -  
100 -- job: Docker  
101 - variables:  
102 - cli11.single: OFF  
103 - pool:  
104 - vmImage: 'ubuntu-latest'  
105 - strategy:  
106 - matrix:  
107 - gcc9:  
108 - containerImage: gcc:9  
109 - cli11.std: 17  
110 - cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5"  
111 - gcc11:  
112 - containerImage: gcc:11  
113 - cli11.std: 20  
114 - gcc8:  
115 - containerImage: gcc:8  
116 - cli11.std: 17  
117 - gcc4.8:  
118 - containerImage: gcc:4.8  
119 - cli11.std: 11  
120 - cli11.options:  
121 - clang3.4:  
122 - containerImage: silkeh/clang:3.4  
123 - cli11.std: 11  
124 - clang8:  
125 - containerImage: silkeh/clang:8  
126 - cli11.std: 14  
127 - cli11.options: -DCLI11_FORCE_LIBCXX=ON  
128 - clang8_17:  
129 - containerImage: silkeh/clang:8  
130 - cli11.std: 17  
131 - cli11.options: -DCLI11_FORCE_LIBCXX=ON  
132 - clang10_20:  
133 - containerImage: silkeh/clang:10  
134 - cli11.std: 20  
135 - cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20  
136 - container: $[ variables['containerImage'] ]  
137 - steps:  
138 - - template: .ci/azure-cmake.yml  
139 - - template: .ci/azure-build.yml  
140 - - template: .ci/azure-test.yml 99 + - job: Docker
  100 + variables:
  101 + cli11.single: OFF
  102 + pool:
  103 + vmImage: "ubuntu-latest"
  104 + strategy:
  105 + matrix:
  106 + gcc9:
  107 + containerImage: gcc:9
  108 + cli11.std: 17
  109 + cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5"
  110 + gcc11:
  111 + containerImage: gcc:11
  112 + cli11.std: 20
  113 + gcc8:
  114 + containerImage: gcc:8
  115 + cli11.std: 17
  116 + gcc4.8:
  117 + containerImage: gcc:4.8
  118 + cli11.std: 11
  119 + cli11.options:
  120 + clang3.4:
  121 + containerImage: silkeh/clang:3.4
  122 + cli11.std: 11
  123 + clang8:
  124 + containerImage: silkeh/clang:8
  125 + cli11.std: 14
  126 + cli11.options: -DCLI11_FORCE_LIBCXX=ON
  127 + clang8_17:
  128 + containerImage: silkeh/clang:8
  129 + cli11.std: 17
  130 + cli11.options: -DCLI11_FORCE_LIBCXX=ON
  131 + clang10_20:
  132 + containerImage: silkeh/clang:10
  133 + cli11.std: 20
  134 + cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20
  135 + container: $[ variables['containerImage'] ]
  136 + steps:
  137 + - template: .ci/azure-cmake.yml
  138 + - template: .ci/azure-build.yml
  139 + - template: .ci/azure-test.yml
book/README.md
@@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
2 2
3 This gitbook is designed to provide an introduction to using the CLI11 library to write your own command line programs. The library is designed to be clean, intuitive, but powerful. There are no requirements beyond C++11 support (and even `<regex>` support not required). It works on Mac, Linux, and Windows, and has 100% test coverage on all three systems. You can simply drop in a single header file (`CLI11.hpp` available in [releases][]) to use CLI11 in your own application. Other ways to integrate it into a build system are listed in the [README][]. 3 This gitbook is designed to provide an introduction to using the CLI11 library to write your own command line programs. The library is designed to be clean, intuitive, but powerful. There are no requirements beyond C++11 support (and even `<regex>` support not required). It works on Mac, Linux, and Windows, and has 100% test coverage on all three systems. You can simply drop in a single header file (`CLI11.hpp` available in [releases][]) to use CLI11 in your own application. Other ways to integrate it into a build system are listed in the [README][].
4 4
5 -The library was inspired the Python libraries [Plumbum][] and [Click][], and incorporates many of their user friendly features. The library is extensively documented, with a [friendly introduction][README], this tutorial book, and more technical [API docs][]. 5 +The library was inspired the Python libraries [Plumbum][] and [Click][], and incorporates many of their user friendly features. The library is extensively documented, with a [friendly introduction][readme], this tutorial book, and more technical [API docs][].
6 6
7 -> Feel free to contribute to [this documentation here][CLI11Tutorial] if something can be improved! 7 +> Feel free to contribute to [this documentation here][cli11tutorial] if something can be improved!
8 8
9 The syntax is simple and scales from a basic application to a massive physics analysis with multiple models and many parameters and switches. For example, this is a simple program that has an optional parameter that defaults to 0: 9 The syntax is simple and scales from a basic application to a massive physics analysis with multiple models and many parameters and switches. For example, this is a simple program that has an optional parameter that defaults to 0:
10 10
@@ -51,7 +51,7 @@ You can use subcommands, as well. Subcommands support callback lambda functions @@ -51,7 +51,7 @@ You can use subcommands, as well. Subcommands support callback lambda functions
51 51
52 Reading/producing `.ini` files for configuration is also supported, as is using environment variables as input. The base `App` can be subclassed and customized for use in a toolkit (like [GooFit][]). All the standard shell idioms, like `--`, work as well. 52 Reading/producing `.ini` files for configuration is also supported, as is using environment variables as input. The base `App` can be subclassed and customized for use in a toolkit (like [GooFit][]). All the standard shell idioms, like `--`, work as well.
53 53
54 -CLI11 was developed at the [University of Cincinnati][] in support of the [GooFit][] library under [NSF Award 1414736][NSF 1414736]. It was featured in a [DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome. 54 +CLI11 was developed at the [University of Cincinnati][] in support of the [GooFit][] library under [NSF Award 1414736][nsf 1414736]. It was featured in a [DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome.
55 55
56 [goofit]: https://github.com/GooFit/GooFit 56 [goofit]: https://github.com/GooFit/GooFit
57 [diana/hep]: https://diana-hep.org 57 [diana/hep]: https://diana-hep.org
book/SUMMARY.md
1 # Summary 1 # Summary
2 2
3 -* [Introduction](/README.md)  
4 -* [Installation](/chapters/installation.md)  
5 -* [Basics](/chapters/basics.md)  
6 -* [Flags](/chapters/flags.md)  
7 -* [Options](/chapters/options.md)  
8 -* [Validators](/chapters/validators.md)  
9 -* [Subcommands and the App](/chapters/subcommands.md)  
10 -* [An advanced example](/chapters/an-advanced-example.md)  
11 -* [Configuration files](/chapters/config.md)  
12 -* [Formatting help output](/chapters/formatting.md)  
13 -* [Toolkits](/chapters/toolkits.md)  
14 -* [Advanced topics](/chapters/advanced-topics.md)  
15 -* [Internals](/chapters/internals.md) 3 +- [Introduction](/README.md)
  4 +- [Installation](/chapters/installation.md)
  5 +- [Basics](/chapters/basics.md)
  6 +- [Flags](/chapters/flags.md)
  7 +- [Options](/chapters/options.md)
  8 +- [Validators](/chapters/validators.md)
  9 +- [Subcommands and the App](/chapters/subcommands.md)
  10 +- [An advanced example](/chapters/an-advanced-example.md)
  11 +- [Configuration files](/chapters/config.md)
  12 +- [Formatting help output](/chapters/formatting.md)
  13 +- [Toolkits](/chapters/toolkits.md)
  14 +- [Advanced topics](/chapters/advanced-topics.md)
  15 +- [Internals](/chapters/internals.md)
book/book.json
1 { 1 {
2 -"title": "CLI11 Tutorial",  
3 -"description": "A set of examples and detailed information about CLI11",  
4 -"author": "Henry Schreiner",  
5 -"plugins": [  
6 - "include-codeblock",  
7 - "term",  
8 - "hints"  
9 - ],  
10 -"pluginsConfig": {  
11 - "include-codeblock": {  
12 - "unindent": true,  
13 - "fixlang": true  
14 - } 2 + "title": "CLI11 Tutorial",
  3 + "description": "A set of examples and detailed information about CLI11",
  4 + "author": "Henry Schreiner",
  5 + "plugins": ["include-codeblock", "term", "hints"],
  6 + "pluginsConfig": {
  7 + "include-codeblock": {
  8 + "unindent": true,
  9 + "fixlang": true
15 } 10 }
  11 + }
16 } 12 }
book/chapters/an-advanced-example.md
@@ -28,4 +28,4 @@ You&#39;ll see it behaves pretty much like `git`. @@ -28,4 +28,4 @@ You&#39;ll see it behaves pretty much like `git`.
28 28
29 ## Multi-file App parse code 29 ## Multi-file App parse code
30 30
31 -This example could be made much nicer if it was split into files, one per subcommand. If you simply use shared pointers instead of raw values in the lambda capture, you can tie the lifetime to the lambda function lifetime. CLI11 has a [multifile example](https://github.com/CLIUtils/CLI11/tree/main/examples/subcom_in_files) in its example folder. 31 +This example could be made much nicer if it was split into files, one per subcommand. If you simply use shared pointers instead of raw values in the lambda capture, you can tie the lifetime to the lambda function lifetime. CLI11 has a [multifile example](https://github.com/CLIUtils/CLI11/tree/main/examples/subcom_in_files) in its example folder.
book/chapters/basics.md
@@ -10,7 +10,7 @@ After entering the main function, you&#39;ll see that a `CLI::App` object is created @@ -10,7 +10,7 @@ After entering the main function, you&#39;ll see that a `CLI::App` object is created
10 10
11 A normal CLI11 application would define some flags and options next. This is a simplest possible example, so we'll go on. 11 A normal CLI11 application would define some flags and options next. This is a simplest possible example, so we'll go on.
12 12
13 -The macro `CLI11_PARSE` just runs five simple lines. This internally runs `app.parse(argc, argv)`, which takes the command line info from C++ and parses it. If there is an error, it throws a `ParseError`; if you catch it, you can use `app.exit` with the error as an argument to print a nice message and produce the correct return code for your application. 13 +The macro `CLI11_PARSE` just runs five simple lines. This internally runs `app.parse(argc, argv)`, which takes the command line info from C++ and parses it. If there is an error, it throws a `ParseError`; if you catch it, you can use `app.exit` with the error as an argument to print a nice message and produce the correct return code for your application.
14 14
15 If you just use `app.parse` directly, your application will still work, but the stack will not be correctly unwound since you have an uncaught exception, and the command line output will be cluttered, especially for help. 15 If you just use `app.parse` directly, your application will still work, but the stack will not be correctly unwound since you have an uncaught exception, and the command line output will be cluttered, especially for help.
16 16
book/chapters/config.md
@@ -20,7 +20,7 @@ app.set_config(&quot;--config&quot;) @@ -20,7 +20,7 @@ app.set_config(&quot;--config&quot;)
20 ->transform(CLI::FileOnDefaultPath("/default_path2/",false)); 20 ->transform(CLI::FileOnDefaultPath("/default_path2/",false));
21 ``` 21 ```
22 22
23 -Multiple default paths can be specified through this mechanism. The last transform given is executed first so the error return must be disabled so it can be chained to the first. The same effect can be achieved though the or(`|`) operation with validators 23 +Multiple default paths can be specified through this mechanism. The last transform given is executed first so the error return must be disabled so it can be chained to the first. The same effect can be achieved though the or(`|`) operation with validators
24 24
25 ```cpp 25 ```cpp
26 app.set_config("--config") 26 app.set_config("--config")
@@ -35,7 +35,7 @@ Sometimes configuration files are used for multiple purposes so CLI11 allows opt @@ -35,7 +35,7 @@ Sometimes configuration files are used for multiple purposes so CLI11 allows opt
35 app.allow_config_extras(true); 35 app.allow_config_extras(true);
36 ``` 36 ```
37 37
38 -will allow capture the extras in the extras field of the app. (NOTE: This also sets the `allow_extras` in the app to true) 38 +will allow capture the extras in the extras field of the app. (NOTE: This also sets the `allow_extras` in the app to true)
39 39
40 ```cpp 40 ```cpp
41 app.allow_config_extras(false); 41 app.allow_config_extras(false);
@@ -48,7 +48,7 @@ for slightly finer control there is a scoped enumeration of the modes or @@ -48,7 +48,7 @@ for slightly finer control there is a scoped enumeration of the modes or
48 app.allow_config_extras(CLI::config_extras_mode::ignore); 48 app.allow_config_extras(CLI::config_extras_mode::ignore);
49 ``` 49 ```
50 50
51 -will completely ignore extra parameters in the config file. This mode is the default. 51 +will completely ignore extra parameters in the config file. This mode is the default.
52 52
53 ```cpp 53 ```cpp
54 app.allow_config_extras(CLI::config_extras_mode::capture); 54 app.allow_config_extras(CLI::config_extras_mode::capture);
@@ -71,7 +71,7 @@ will completely ignore any mismatches, extras, or other issues with the config f @@ -71,7 +71,7 @@ will completely ignore any mismatches, extras, or other issues with the config f
71 ### Getting the used configuration file name 71 ### Getting the used configuration file name
72 72
73 If it is needed to get the configuration file name used this can be obtained via 73 If it is needed to get the configuration file name used this can be obtained via
74 -`app.get_config_ptr()->as<std::string>()` or 74 +`app.get_config_ptr()->as<std::string>()` or
75 `app["--config"]->as<std::string>()` assuming `--config` was the configuration option name. 75 `app["--config"]->as<std::string>()` assuming `--config` was the configuration option name.
76 76
77 ## Configure file format 77 ## Configure file format
@@ -111,11 +111,11 @@ in_subcommand = Wow @@ -111,11 +111,11 @@ in_subcommand = Wow
111 sub.subcommand = true 111 sub.subcommand = true
112 ``` 112 ```
113 113
114 -The main differences are in vector notation and comment character. Note: CLI11 is not a full TOML parser as it just reads values as strings. It is possible (but not recommended) to mix notation. 114 +The main differences are in vector notation and comment character. Note: CLI11 is not a full TOML parser as it just reads values as strings. It is possible (but not recommended) to mix notation.
115 115
116 ## Multiple configuration files 116 ## Multiple configuration files
117 117
118 -If it is desired that multiple configuration be allowed. Use 118 +If it is desired that multiple configuration be allowed. Use
119 119
120 ```cpp 120 ```cpp
121 app.set_config("--config")->expected(1, X); 121 app.set_config("--config")->expected(1, X);
@@ -147,7 +147,7 @@ if a prefix is needed to print before the options, for example to print a config @@ -147,7 +147,7 @@ if a prefix is needed to print before the options, for example to print a config
147 147
148 ### Customization of configure file output 148 ### Customization of configure file output
149 149
150 -The default config parser/generator has some customization points that allow variations on the TOML format. The default formatter has a base configuration that matches the TOML format. It defines 5 characters that define how different aspects of the configuration are handled. You must use `get_config_formatter_base()` to have access to these fields 150 +The default config parser/generator has some customization points that allow variations on the TOML format. The default formatter has a base configuration that matches the TOML format. It defines 5 characters that define how different aspects of the configuration are handled. You must use `get_config_formatter_base()` to have access to these fields
151 151
152 ```cpp 152 ```cpp
153 /// the character used for comments 153 /// the character used for comments
@@ -176,15 +176,15 @@ std::string configSection; @@ -176,15 +176,15 @@ std::string configSection;
176 176
177 These can be modified via setter functions 177 These can be modified via setter functions
178 178
179 -* `ConfigBase *comment(char cchar)`: Specify the character to start a comment block  
180 -* `ConfigBase *arrayBounds(char aStart, char aEnd)`: Specify the start and end characters for an array  
181 -* `ConfigBase *arrayDelimiter(char aSep)`: Specify the delimiter character for an array  
182 -* `ConfigBase *valueSeparator(char vSep)`: Specify the delimiter between a name and value  
183 -* `ConfigBase *quoteCharacter(char qString, char qChar)` :specify the characters to use around strings and single characters  
184 -* `ConfigBase *maxLayers(uint8_t layers)` : specify the maximum number of parent layers to process. This is useful to limit processing for larger config files  
185 -* `ConfigBase *parentSeparator(char sep)` : specify the character to separate parent layers from options  
186 -* `ConfigBase *section(const std::string &sectionName)` : specify the section name to use to get the option values, only this section will be processed  
187 -* `ConfigBase *index(uint16_t sectionIndex)` : specify an index section to use for processing if multiple TOML sections of the same name are present `[[section]]` 179 +- `ConfigBase *comment(char cchar)`: Specify the character to start a comment block
  180 +- `ConfigBase *arrayBounds(char aStart, char aEnd)`: Specify the start and end characters for an array
  181 +- `ConfigBase *arrayDelimiter(char aSep)`: Specify the delimiter character for an array
  182 +- `ConfigBase *valueSeparator(char vSep)`: Specify the delimiter between a name and value
  183 +- `ConfigBase *quoteCharacter(char qString, char qChar)` :specify the characters to use around strings and single characters
  184 +- `ConfigBase *maxLayers(uint8_t layers)` : specify the maximum number of parent layers to process. This is useful to limit processing for larger config files
  185 +- `ConfigBase *parentSeparator(char sep)` : specify the character to separate parent layers from options
  186 +- `ConfigBase *section(const std::string &sectionName)` : specify the section name to use to get the option values, only this section will be processed
  187 +- `ConfigBase *index(uint16_t sectionIndex)` : specify an index section to use for processing if multiple TOML sections of the same name are present `[[section]]`
188 188
189 For example, to specify reading a configure file that used `:` to separate name and values: 189 For example, to specify reading a configure file that used `:` to separate name and values:
190 190
@@ -193,7 +193,7 @@ auto config_base=app.get_config_formatter_base(); @@ -193,7 +193,7 @@ auto config_base=app.get_config_formatter_base();
193 config_base->valueSeparator(':'); 193 config_base->valueSeparator(':');
194 ``` 194 ```
195 195
196 -The default configuration file will read INI files, but will write out files in the TOML format. To specify outputting INI formatted files use 196 +The default configuration file will read INI files, but will write out files in the TOML format. To specify outputting INI formatted files use
197 197
198 ```cpp 198 ```cpp
199 app.config_formatter(std::make_shared<CLI::ConfigINI>()); 199 app.config_formatter(std::make_shared<CLI::ConfigINI>());
@@ -236,21 +236,21 @@ The parser can handle these structures with only a minor tweak @@ -236,21 +236,21 @@ The parser can handle these structures with only a minor tweak
236 app.get_config_formatter_base()->valueSeparator(':'); 236 app.get_config_formatter_base()->valueSeparator(':');
237 ``` 237 ```
238 238
239 -The open and close brackets must be on a separate line and the comma gets interpreted as an array separator but since no values are after the comma they get ignored as well. This will not support multiple layers or sections or any other moderately complex JSON, but can work if the input file is simple. 239 +The open and close brackets must be on a separate line and the comma gets interpreted as an array separator but since no values are after the comma they get ignored as well. This will not support multiple layers or sections or any other moderately complex JSON, but can work if the input file is simple.
240 240
241 ## Triggering Subcommands 241 ## Triggering Subcommands
242 242
243 -Configuration files can be used to trigger subcommands if a subcommand is set to configure. By default configuration file just set the default values of a subcommand. But if the `configure()` option is set on a subcommand then the if the subcommand is utilized via a `[subname]` block in the configuration file it will act as if it were called from the command line. Subsubcommands can be triggered via `[subname.subsubname]`. Using the `[[subname]]` will be as if the subcommand were triggered multiple times from the command line. This functionality can allow the configuration file to act as a scripting file. 243 +Configuration files can be used to trigger subcommands if a subcommand is set to configure. By default configuration file just set the default values of a subcommand. But if the `configure()` option is set on a subcommand then the if the subcommand is utilized via a `[subname]` block in the configuration file it will act as if it were called from the command line. Subsubcommands can be triggered via `[subname.subsubname]`. Using the `[[subname]]` will be as if the subcommand were triggered multiple times from the command line. This functionality can allow the configuration file to act as a scripting file.
244 244
245 -For custom configuration files this behavior can be triggered by specifying the parent subcommands in the structure and `++` as the name to open a new subcommand scope and `--` to close it. These names trigger the different callbacks of configurable subcommands. 245 +For custom configuration files this behavior can be triggered by specifying the parent subcommands in the structure and `++` as the name to open a new subcommand scope and `--` to close it. These names trigger the different callbacks of configurable subcommands.
246 246
247 ## Stream parsing 247 ## Stream parsing
248 248
249 -In addition to the regular parse functions a `parse_from_stream(std::istream &input)` is available to directly parse a stream operator. For example to process some arguments in an already open file stream. The stream is fed directly in the config parser so bypasses the normal command line parsing. 249 +In addition to the regular parse functions a `parse_from_stream(std::istream &input)` is available to directly parse a stream operator. For example to process some arguments in an already open file stream. The stream is fed directly in the config parser so bypasses the normal command line parsing.
250 250
251 ## Implementation Notes 251 ## Implementation Notes
252 252
253 -The config file input works with any form of the option given: Long, short, positional, or the environment variable name. When generating a config file it will create an option name in following priority. 253 +The config file input works with any form of the option given: Long, short, positional, or the environment variable name. When generating a config file it will create an option name in following priority.
254 254
255 1. First long name 255 1. First long name
256 2. Positional name 256 2. Positional name
book/chapters/flags.md
@@ -11,7 +11,7 @@ bool my_flag{false}; @@ -11,7 +11,7 @@ bool my_flag{false};
11 app.add_flag("-f", my_flag, "Optional description"); 11 app.add_flag("-f", my_flag, "Optional description");
12 ``` 12 ```
13 13
14 -This will bind the flag `-f` to the boolean `my_flag`. After the parsing step, `my_flag` will be `false` if the flag was not found on the command line, or `true` if it was. By default, it will be allowed any number of times, but if you explicitly\[^1\] request `->take_last(false)`, it will only be allowed once; passing something like `./my_app -f -f` or `./my_app -ff` will throw a `ParseError` with a nice help description. A flag name may start with any character except ('-', ' ', '\n', and '!'). For long flags, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed. 14 +This will bind the flag `-f` to the boolean `my_flag`. After the parsing step, `my_flag` will be `false` if the flag was not found on the command line, or `true` if it was. By default, it will be allowed any number of times, but if you explicitly\[^1\] request `->take_last(false)`, it will only be allowed once; passing something like `./my_app -f -f` or `./my_app -ff` will throw a `ParseError` with a nice help description. A flag name may start with any character except ('-', ' ', '\n', and '!'). For long flags, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed.
15 15
16 ## Integer flags 16 ## Integer flags
17 17
@@ -28,29 +28,29 @@ This behavior can also be controlled manually via `-&gt;multi_option_policy(CLI::Mu @@ -28,29 +28,29 @@ This behavior can also be controlled manually via `-&gt;multi_option_policy(CLI::Mu
28 28
29 ## Arbitrary type flags 29 ## Arbitrary type flags
30 30
31 -CLI11 allows the type of the variable to assign to in the `add_flag` function to be any supported type. This is particularly useful in combination with specifying default values for flags. The allowed types include bool, int, float, vector, enum, or string-like. 31 +CLI11 allows the type of the variable to assign to in the `add_flag` function to be any supported type. This is particularly useful in combination with specifying default values for flags. The allowed types include bool, int, float, vector, enum, or string-like.
32 32
33 ### Default Flag Values 33 ### Default Flag Values
34 34
35 -Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example: 35 +Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example:
36 36
37 ```cpp 37 ```cpp
38 app.add_flag("--flag,!--no-flag",result,"help for flag"); 38 app.add_flag("--flag,!--no-flag",result,"help for flag");
39 ``` 39 ```
40 40
41 specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is 41 specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is
42 -passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An 42 +passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An
43 alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous 43 alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous
44 -example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the 44 +example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the
45 default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum 45 default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum
46 -all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited). 46 +all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited).
47 The default value can be any value. For example if you wished to define a numerical flag: 47 The default value can be any value. For example if you wished to define a numerical flag:
48 48
49 ```cpp 49 ```cpp
50 app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag") 50 app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag")
51 ``` 51 ```
52 52
53 -using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type. 53 +using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type.
54 54
55 ## Pure flags 55 ## Pure flags
56 56
book/chapters/formatting.md
@@ -10,10 +10,10 @@ In CLI11, you can control the output of the help printout in full or in part. Th @@ -10,10 +10,10 @@ In CLI11, you can control the output of the help printout in full or in part. Th
10 10
11 There are several configuration options that you can set: 11 There are several configuration options that you can set:
12 12
13 -| Set method | Description | Availability |  
14 -|------------|-------------|--------------|  
15 -| `column_width(width)` | The width of the columns | Both |  
16 -| `label(key, value)` | Set a label to a different value | Both | 13 +| Set method | Description | Availability |
  14 +| --------------------- | -------------------------------- | ------------ |
  15 +| `column_width(width)` | The width of the columns | Both |
  16 +| `label(key, value)` | Set a label to a different value | Both |
17 17
18 Labels will map the built in names and type names from key to value if present. For example, if you wanted to change the width of the columns to 40 and the `REQUIRED` label from `(REQUIRED)` to `(MUST HAVE)`: 18 Labels will map the built in names and type names from key to value if present. For example, if you wanted to change the width of the columns to 40 and the `REQUIRED` label from `(REQUIRED)` to `(MUST HAVE)`:
19 19
@@ -69,5 +69,5 @@ make_option_name(o,p) make_option_desc(o) @@ -69,5 +69,5 @@ make_option_name(o,p) make_option_desc(o)
69 69
70 Notes: 70 Notes:
71 71
72 -* `*1`: This signature depends on whether the call is from a positional or optional.  
73 -* `o` is opt pointer, `p` is true if positional. 72 +- `*1`: This signature depends on whether the call is from a positional or optional.
  73 +- `o` is opt pointer, `p` is true if positional.
book/chapters/installation.md
@@ -80,13 +80,13 @@ Total Test time (real) = 0.34 sec @@ -80,13 +80,13 @@ Total Test time (real) = 0.34 sec
80 80
81 For the curious, the CMake options and defaults are listed below. Most options default to off if CLI11 is used as a subdirectory in another project. 81 For the curious, the CMake options and defaults are listed below. Most options default to off if CLI11 is used as a subdirectory in another project.
82 82
83 -| Option | Description |  
84 -|--------|-------------|  
85 -| `CLI11_SINGLE_FILE=ON` | Build the `CLI11.hpp` file from the sources. Requires Python (version 3 or 2.7). |  
86 -| `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well |  
87 -| `CLI11_EXAMPLES=ON` | Build the example programs. |  
88 -| `CLI11_TESTING=ON` | Build the tests. |  
89 -| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. | 83 +| Option | Description |
  84 +| ----------------------------- | ----------------------------------------------------------------------------------------------- |
  85 +| `CLI11_SINGLE_FILE=ON` | Build the `CLI11.hpp` file from the sources. Requires Python (version 3 or 2.7). |
  86 +| `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well |
  87 +| `CLI11_EXAMPLES=ON` | Build the example programs. |
  88 +| `CLI11_TESTING=ON` | Build the tests. |
  89 +| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. |
90 | `CLI11_CLANG_TIDY_OPTIONS=""` | Options to pass to `clang-tidy`, such as `-fix` (single threaded build only if applying fixes!) | 90 | `CLI11_CLANG_TIDY_OPTIONS=""` | Options to pass to `clang-tidy`, such as `-fix` (single threaded build only if applying fixes!) |
91 91
92 [^1]: Docker is being used to create a pristine disposable environment; there is nothing special about this container. Alpine is being used because it is small, modern, and fast. Commands are similar on any other platform. 92 [^1]: Docker is being used to create a pristine disposable environment; there is nothing special about this container. Alpine is being used because it is small, modern, and fast. Commands are similar on any other platform.
book/chapters/options.md
@@ -18,20 +18,20 @@ app.add_option(&quot;-i&quot;, int_option, &quot;Optional description&quot;)-&gt;capture_default_str(); @@ -18,20 +18,20 @@ app.add_option(&quot;-i&quot;, int_option, &quot;Optional description&quot;)-&gt;capture_default_str();
18 18
19 You can use any C++ int-like type, not just `int`. CLI11 understands the following categories of types: 19 You can use any C++ int-like type, not just `int`. CLI11 understands the following categories of types:
20 20
21 -| Type | CLI11 |  
22 -|-------------|-------|  
23 -| number like | Integers, floats, bools, or any type that can be constructed from an integer or floating point number. Accepts common numerical strings like `0xFF` as well as octal, and decimal |  
24 -| string-like | std::string, or anything that can be constructed from or assigned a std::string |  
25 -| char | For a single char, single string values are accepted, otherwise longer strings are treated as integral values and a conversion is attempted |  
26 -| complex-number | std::complex or any type which has a real(), and imag() operations available, will allow 1 or 2 string definitions like "1+2j" or two arguments "1","2" |  
27 -| enumeration | any enum or enum class type is supported through conversion from the underlying type(typically int, though it can be specified otherwise) |  
28 -| container-like | a container(like vector) of any available types including other containers |  
29 -| wrapper | any other object with a `value_type` static definition where the type specified by `value_type` is one of the type in this list, including `std::atomic<>` |  
30 -| tuple | a tuple, pair, or array, or other type with a tuple size and tuple_type operations defined and the members being a type contained in this list |  
31 -| function | A function that takes an array of strings and returns a string that describes the conversion failure or empty for success. May be the empty function. (`{}`) |  
32 -| streamable | any other type with a `<<` operator will also work |  
33 -  
34 -By default, CLI11 will assume that an option is optional, and one value is expected if you do not use a vector. You can change this on a specific option using option modifiers. An option name may start with any character except ('-', ' ', '\n', and '!'). For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An option can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form. 21 +| Type | CLI11 |
  22 +| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  23 +| number like | Integers, floats, bools, or any type that can be constructed from an integer or floating point number. Accepts common numerical strings like `0xFF` as well as octal, and decimal |
  24 +| string-like | std::string, or anything that can be constructed from or assigned a std::string |
  25 +| char | For a single char, single string values are accepted, otherwise longer strings are treated as integral values and a conversion is attempted |
  26 +| complex-number | std::complex or any type which has a real(), and imag() operations available, will allow 1 or 2 string definitions like "1+2j" or two arguments "1","2" |
  27 +| enumeration | any enum or enum class type is supported through conversion from the underlying type(typically int, though it can be specified otherwise) |
  28 +| container-like | a container(like vector) of any available types including other containers |
  29 +| wrapper | any other object with a `value_type` static definition where the type specified by `value_type` is one of the type in this list, including `std::atomic<>` |
  30 +| tuple | a tuple, pair, or array, or other type with a tuple size and tuple_type operations defined and the members being a type contained in this list |
  31 +| function | A function that takes an array of strings and returns a string that describes the conversion failure or empty for success. May be the empty function. (`{}`) |
  32 +| streamable | any other type with a `<<` operator will also work |
  33 +
  34 +By default, CLI11 will assume that an option is optional, and one value is expected if you do not use a vector. You can change this on a specific option using option modifiers. An option name may start with any character except ('-', ' ', '\n', and '!'). For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An option can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form.
35 35
36 ## Positional options and aliases 36 ## Positional options and aliases
37 37
@@ -55,11 +55,11 @@ This would make two short option aliases, two long option alias, and the option @@ -55,11 +55,11 @@ This would make two short option aliases, two long option alias, and the option
55 55
56 If you use a vector or other container instead of a plain option, you can accept more than one value on the command line. By default, a container accepts as many options as possible, until the next value that could be a valid option name. You can specify a set number using an option modifier `->expected(N)`. (The default unlimited behavior on vectors is restored with `N=-1`) CLI11 does not differentiate between these two methods for unlimited acceptance options. 56 If you use a vector or other container instead of a plain option, you can accept more than one value on the command line. By default, a container accepts as many options as possible, until the next value that could be a valid option name. You can specify a set number using an option modifier `->expected(N)`. (The default unlimited behavior on vectors is restored with `N=-1`) CLI11 does not differentiate between these two methods for unlimited acceptance options.
57 57
58 -| Separate names | Combined names |  
59 -|-------------------|-----------------|  
60 -| `--vec 1 --vec 2` | `--vec 1 2` | 58 +| Separate names | Combined names |
  59 +| ----------------- | -------------- |
  60 +| `--vec 1 --vec 2` | `--vec 1 2` |
61 61
62 -It is also possible to specify a minimum and maximum number through `->expected(Min,Max)`. It is also possible to specify a min and max type size for the elements of the container. It most cases these values will be automatically determined but a user can manually restrict them. 62 +It is also possible to specify a minimum and maximum number through `->expected(Min,Max)`. It is also possible to specify a min and max type size for the elements of the container. It most cases these values will be automatically determined but a user can manually restrict them.
63 63
64 An example of setting up a vector option: 64 An example of setting up a vector option:
65 65
@@ -70,11 +70,11 @@ app.add_option(&quot;--vec&quot;, int_vec, &quot;My vector option&quot;); @@ -70,11 +70,11 @@ app.add_option(&quot;--vec&quot;, int_vec, &quot;My vector option&quot;);
70 70
71 Vectors will be replaced by the parsed content if the option is given on the command line. 71 Vectors will be replaced by the parsed content if the option is given on the command line.
72 72
73 -A definition of a container for purposes of CLI11 is a type with a `end()`, `insert(...)`, `clear()` and `value_type` definitions. This includes `vector`, `set`, `deque`, `list`, `forward_iist`, `map`, `unordered_map` and a few others from the standard library, and many other containers from the boost library. 73 +A definition of a container for purposes of CLI11 is a type with a `end()`, `insert(...)`, `clear()` and `value_type` definitions. This includes `vector`, `set`, `deque`, `list`, `forward_iist`, `map`, `unordered_map` and a few others from the standard library, and many other containers from the boost library.
74 74
75 ### Empty containers 75 ### Empty containers
76 76
77 -By default a container will never return an empty container. If it is desired to allow an empty container to be returned, then the option must be modified with a 0 as the minimum expected value 77 +By default a container will never return an empty container. If it is desired to allow an empty container to be returned, then the option must be modified with a 0 as the minimum expected value
78 78
79 ```cpp 79 ```cpp
80 std::vector<int> int_vec; 80 std::vector<int> int_vec;
@@ -113,7 +113,7 @@ std::vector&lt;std::vector&lt;int&gt;&gt; int_vec; @@ -113,7 +113,7 @@ std::vector&lt;std::vector&lt;int&gt;&gt; int_vec;
113 app.add_option("--vec", int_vec, "My vector of vectors option"); 113 app.add_option("--vec", int_vec, "My vector of vectors option");
114 ``` 114 ```
115 115
116 -CLI11 inserts a separator sequence at the start of each argument call to separate the vectors. So unless the separators are injected as part of the command line each call of the option on the command line will result in a separate element of the outer vector. This can be manually controlled via `inject_separator(true|false)` but in nearly all cases this should be left to the defaults. To insert of a separator from the command line add a `%%` where the separation should occur. 116 +CLI11 inserts a separator sequence at the start of each argument call to separate the vectors. So unless the separators are injected as part of the command line each call of the option on the command line will result in a separate element of the outer vector. This can be manually controlled via `inject_separator(true|false)` but in nearly all cases this should be left to the defaults. To insert of a separator from the command line add a `%%` where the separation should occur.
117 117
118 ```bash 118 ```bash
119 cmd --vec_of_vec 1 2 3 4 %% 1 2 119 cmd --vec_of_vec 1 2 3 4 %% 1 2
@@ -154,41 +154,41 @@ will result in a requirement for 2 integers on each invocation and absorb an unl @@ -154,41 +154,41 @@ will result in a requirement for 2 integers on each invocation and absorb an unl
154 154
155 When you call `add_option`, you get a pointer to the added option. You can use that to add option modifiers. A full listing of the option modifiers: 155 When you call `add_option`, you get a pointer to the added option. You can use that to add option modifiers. A full listing of the option modifiers:
156 156
157 -| Modifier | Description |  
158 -|----------|-------------|  
159 -| `->required()` | The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works. |  
160 -| `->expected(N)` | Take `N` values instead of as many as possible, mainly for vector args. |  
161 -| `->expected(Nmin,Nmax)` | Take between `Nmin` and `Nmax` values. |  
162 -| `->type_size(N)` | specify that each block of values would consist of N elements |  
163 -| `->type_size(Nmin,Nmax)` | specify that each block of values would consist of between Nmin and Nmax elements |  
164 -| `->needs(opt)` | This option requires another option to also be present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_needs(opt)` |  
165 -| `->excludes(opt)` | This option cannot be given with `opt` present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_excludes(opt)` |  
166 -| `->envname(name)` | Gets the value from the environment if present and not passed on the command line. |  
167 -| `->group(name)` | The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `"Hidden"` will not show up in the help print. |  
168 -| `->description(string)` | Set/change the description |  
169 -| `->ignore_case()` | Ignore the case on the command line (also works on subcommands, does not affect arguments). |  
170 -| `->ignore_underscore()` | Ignore any underscores on the command line (also works on subcommands, does not affect arguments). |  
171 -| `->allow_extra_args()` | Allow extra argument values to be included when an option is passed. Enabled by default for vector options. |  
172 -| `->disable_flag_override()` | specify that flag options cannot be overridden on the command line use `=<newval>` |  
173 -| `->delimiter('<CH>')` | specify a character that can be used to separate elements in a command line argument, default is <none>, common values are ',', and ';' |  
174 -| `->multi_option_policy( CLI::MultiOptionPolicy::Throw)` | Sets the policy for handling multiple arguments if the option was received on the command line several times. `Throw`ing an error is the default, but `TakeLast`, `TakeFirst`, `TakeAll`, `Join`, and `Sum` are also available. See the next four lines for shortcuts to set this more easily. |  
175 -| `->take_last()` | Only use the last option if passed several times. This is always true by default for bool options, regardless of the app default, but can be set to false explicitly with `->multi_option_policy()`. |  
176 -| `->take_first()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeFirst)` |  
177 -| `->take_all()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeAll)` |  
178 -| `->join()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses newlines or the specified delimiter to join all arguments into a single string output. |  
179 -| `->join(delim)` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses `delim` to join all arguments into a single string output. this also sets the delimiter |  
180 -| `->check(Validator)` | perform a check on the returned results to verify they meet some criteria. See [Validators](./validators.md) for more info |  
181 -| `->transform(Validator)` | Run a transforming validator on each value passed. See [Validators](./validators.md) for more info |  
182 -| `->each(void(std::string))` | Run a function on each parsed value, *in order*. |  
183 -| `->default_str(string)` | set a default string for use in the help and as a default value if no arguments are passed and a value is requested |  
184 -| `->default_function(std::string())` | Advanced: Change the function that `capture_default_str()` uses. |  
185 -| `->default_val(value)` | Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). |  
186 -| `->capture_default_str()` | Store the current value attached and display it in the help string. |  
187 -| `->always_capture_default()` | Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. |  
188 -| `->run_callback_for_default()` | Force the option callback to be executed or the variable set when the `default_val` is used. |  
189 -| `->force_callback()` | Force the option callback to be executed regardless of whether the option was used or not. Will use the default_str if available, if no default is given the callback will be executed with an empty string as an argument, which will translate to a default initialized value, which can be compiler dependent |  
190 -| `->trigger_on_parse()` | Have the option callback be triggered when the value is parsed vs. at the end of all parsing, the option callback can potentially be executed multiple times. Generally only useful if you have a user defined callback or validation check. Or potentially if a vector input is given multiple times as it will clear the results when a repeat option is given via command line. It will trigger the callbacks once per option call on the command line|  
191 -| `->option_text(string)` | Sets the text between the option name and description. | 157 +| Modifier | Description |
  158 +| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  159 +| `->required()` | The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works. |
  160 +| `->expected(N)` | Take `N` values instead of as many as possible, mainly for vector args. |
  161 +| `->expected(Nmin,Nmax)` | Take between `Nmin` and `Nmax` values. |
  162 +| `->type_size(N)` | specify that each block of values would consist of N elements |
  163 +| `->type_size(Nmin,Nmax)` | specify that each block of values would consist of between Nmin and Nmax elements |
  164 +| `->needs(opt)` | This option requires another option to also be present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_needs(opt)` |
  165 +| `->excludes(opt)` | This option cannot be given with `opt` present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_excludes(opt)` |
  166 +| `->envname(name)` | Gets the value from the environment if present and not passed on the command line. |
  167 +| `->group(name)` | The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `"Hidden"` will not show up in the help print. |
  168 +| `->description(string)` | Set/change the description |
  169 +| `->ignore_case()` | Ignore the case on the command line (also works on subcommands, does not affect arguments). |
  170 +| `->ignore_underscore()` | Ignore any underscores on the command line (also works on subcommands, does not affect arguments). |
  171 +| `->allow_extra_args()` | Allow extra argument values to be included when an option is passed. Enabled by default for vector options. |
  172 +| `->disable_flag_override()` | specify that flag options cannot be overridden on the command line use `=<newval>` |
  173 +| `->delimiter('<CH>')` | specify a character that can be used to separate elements in a command line argument, default is <none>, common values are ',', and ';' |
  174 +| `->multi_option_policy( CLI::MultiOptionPolicy::Throw)` | Sets the policy for handling multiple arguments if the option was received on the command line several times. `Throw`ing an error is the default, but `TakeLast`, `TakeFirst`, `TakeAll`, `Join`, and `Sum` are also available. See the next four lines for shortcuts to set this more easily. |
  175 +| `->take_last()` | Only use the last option if passed several times. This is always true by default for bool options, regardless of the app default, but can be set to false explicitly with `->multi_option_policy()`. |
  176 +| `->take_first()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeFirst)` |
  177 +| `->take_all()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeAll)` |
  178 +| `->join()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses newlines or the specified delimiter to join all arguments into a single string output. |
  179 +| `->join(delim)` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses `delim` to join all arguments into a single string output. this also sets the delimiter |
  180 +| `->check(Validator)` | perform a check on the returned results to verify they meet some criteria. See [Validators](./validators.md) for more info |
  181 +| `->transform(Validator)` | Run a transforming validator on each value passed. See [Validators](./validators.md) for more info |
  182 +| `->each(void(std::string))` | Run a function on each parsed value, _in order_. |
  183 +| `->default_str(string)` | set a default string for use in the help and as a default value if no arguments are passed and a value is requested |
  184 +| `->default_function(std::string())` | Advanced: Change the function that `capture_default_str()` uses. |
  185 +| `->default_val(value)` | Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). |
  186 +| `->capture_default_str()` | Store the current value attached and display it in the help string. |
  187 +| `->always_capture_default()` | Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. |
  188 +| `->run_callback_for_default()` | Force the option callback to be executed or the variable set when the `default_val` is used. |
  189 +| `->force_callback()` | Force the option callback to be executed regardless of whether the option was used or not. Will use the default_str if available, if no default is given the callback will be executed with an empty string as an argument, which will translate to a default initialized value, which can be compiler dependent |
  190 +| `->trigger_on_parse()` | Have the option callback be triggered when the value is parsed vs. at the end of all parsing, the option callback can potentially be executed multiple times. Generally only useful if you have a user defined callback or validation check. Or potentially if a vector input is given multiple times as it will clear the results when a repeat option is given via command line. It will trigger the callbacks once per option call on the command line |
  191 +| `->option_text(string)` | Sets the text between the option name and description. |
192 192
193 The `->check(...)` and `->transform(...)` modifiers can also take a callback function of the form `bool function(std::string)` that runs on every value that the option receives, and returns a value that tells CLI11 whether the check passed or failed. 193 The `->check(...)` and `->transform(...)` modifiers can also take a callback function of the form `bool function(std::string)` that runs on every value that the option receives, and returns a value that tells CLI11 whether the check passed or failed.
194 194
@@ -209,15 +209,15 @@ if(* opt) @@ -209,15 +209,15 @@ if(* opt)
209 209
210 One of CLI11's systems to allow customizability without high levels of verbosity is the inheritance system. You can set default values on the parent `App`, and all options and subcommands created from it remember the default values at the point of creation. The default value for Options, specifically, are accessible through the `option_defaults()` method. There are a number of settings that can be set and inherited: 210 One of CLI11's systems to allow customizability without high levels of verbosity is the inheritance system. You can set default values on the parent `App`, and all options and subcommands created from it remember the default values at the point of creation. The default value for Options, specifically, are accessible through the `option_defaults()` method. There are a number of settings that can be set and inherited:
211 211
212 -* `group`: The group name starts as "Options"  
213 -* `required`: If the option must be given. Defaults to `false`. Is ignored for flags.  
214 -* `multi_option_policy`: What to do if several copies of an option are passed and one value is expected. Defaults to `CLI::MultiOptionPolicy::Throw`. This is also used for bool flags, but they always are created with the value `CLI::MultiOptionPolicy::TakeLast` or `CLI::MultiOptionPolicy::Sum` regardless of the default, so that multiple bool flags does not cause an error. But you can override that setting by calling the `multi_option_policy` directly.  
215 -* `ignore_case`: Allow any mixture of cases for the option or flag name  
216 -* `ignore_underscore`: Allow any number of underscores in the option or flag name  
217 -* `configurable`: Specify whether an option can be configured through a config file  
218 -* `disable_flag_override`: do not allow flag values to be overridden on the command line  
219 -* `always_capture_default`: specify that the default values should be automatically captured.  
220 -* `delimiter`: A delimiter to use for capturing multiple values in a single command line string (e.g. --flag="flag,-flag2,flag3") 212 +- `group`: The group name starts as "Options"
  213 +- `required`: If the option must be given. Defaults to `false`. Is ignored for flags.
  214 +- `multi_option_policy`: What to do if several copies of an option are passed and one value is expected. Defaults to `CLI::MultiOptionPolicy::Throw`. This is also used for bool flags, but they always are created with the value `CLI::MultiOptionPolicy::TakeLast` or `CLI::MultiOptionPolicy::Sum` regardless of the default, so that multiple bool flags does not cause an error. But you can override that setting by calling the `multi_option_policy` directly.
  215 +- `ignore_case`: Allow any mixture of cases for the option or flag name
  216 +- `ignore_underscore`: Allow any number of underscores in the option or flag name
  217 +- `configurable`: Specify whether an option can be configured through a config file
  218 +- `disable_flag_override`: do not allow flag values to be overridden on the command line
  219 +- `always_capture_default`: specify that the default values should be automatically captured.
  220 +- `delimiter`: A delimiter to use for capturing multiple values in a single command line string (e.g. --flag="flag,-flag2,flag3")
221 221
222 An example of usage: 222 An example of usage:
223 223
@@ -234,18 +234,18 @@ Groups are mostly for visual organization, but an empty string for a group name @@ -234,18 +234,18 @@ Groups are mostly for visual organization, but an empty string for a group name
234 234
235 You can also set the app setting `app->allow_windows_style_options()` to allow windows style options to also be recognized on the command line: 235 You can also set the app setting `app->allow_windows_style_options()` to allow windows style options to also be recognized on the command line:
236 236
237 -* `/a` (flag)  
238 -* `/f filename` (option)  
239 -* `/long` (long flag)  
240 -* `/file filename` (space)  
241 -* `/file:filename` (colon)  
242 -* `/long_flag:false` (long flag with : to override the default value) 237 +- `/a` (flag)
  238 +- `/f filename` (option)
  239 +- `/long` (long flag)
  240 +- `/file filename` (space)
  241 +- `/file:filename` (colon)
  242 +- `/long_flag:false` (long flag with : to override the default value)
243 243
244 Windows style options do not allow combining short options or values not separated from the short option like with `-` options. You still specify option names in the same manner as on Linux with single and double dashes when you use the `add_*` functions, and the Linux style on the command line will still work. If a long and a short option share the same name, the option will match on the first one defined. 244 Windows style options do not allow combining short options or values not separated from the short option like with `-` options. You still specify option names in the same manner as on Linux with single and double dashes when you use the `add_*` functions, and the Linux style on the command line will still work. If a long and a short option share the same name, the option will match on the first one defined.
245 245
246 ## Parse configuration 246 ## Parse configuration
247 247
248 -How an option and its arguments are parsed depends on a set of controls that are part of the option structure. In most circumstances these controls are set automatically based on the type or function used to create the option and the type the arguments are parsed into. The variables define the size of the underlying type (essentially how many strings make up the type), the expected size (how many groups are expected) and a flag indicating if multiple groups are allowed with a single option. And these interact with the `multi_option_policy` when it comes time to parse. 248 +How an option and its arguments are parsed depends on a set of controls that are part of the option structure. In most circumstances these controls are set automatically based on the type or function used to create the option and the type the arguments are parsed into. The variables define the size of the underlying type (essentially how many strings make up the type), the expected size (how many groups are expected) and a flag indicating if multiple groups are allowed with a single option. And these interact with the `multi_option_policy` when it comes time to parse.
249 249
250 ### Examples 250 ### Examples
251 251
@@ -256,7 +256,7 @@ std::string val; @@ -256,7 +256,7 @@ std::string val;
256 app.add_option("--opt",val,"description"); 256 app.add_option("--opt",val,"description");
257 ``` 257 ```
258 258
259 -creates an option that assigns a value to a `std::string` When this option is constructed it sets a type_size min and max of 1. Meaning that the assignment uses a single string. The Expected size is also set to 1 by default, and `allow_extra_args` is set to false. meaning that each time this option is called 1 argument is expected. This would also be the case if val were a `double`, `int` or any other single argument types. 259 +creates an option that assigns a value to a `std::string` When this option is constructed it sets a type_size min and max of 1. Meaning that the assignment uses a single string. The Expected size is also set to 1 by default, and `allow_extra_args` is set to false. meaning that each time this option is called 1 argument is expected. This would also be the case if val were a `double`, `int` or any other single argument types.
260 260
261 now for example 261 now for example
262 262
@@ -272,14 +272,14 @@ std::vector&lt;int&gt; val; @@ -272,14 +272,14 @@ std::vector&lt;int&gt; val;
272 app.add_option("--opt",val,"description"); 272 app.add_option("--opt",val,"description");
273 ``` 273 ```
274 274
275 -detects a type size of 1, since the underlying element type is a single string, so the minimum number of strings is 1. But since it is a vector the expected number can be very big. The default for a vector is (1<<30), and the allow_extra_args is set to true. This means that at least 1 argument is expected to follow the option, but arbitrary numbers of arguments may follow. These are checked if they have the form of an option but if not they are added to the argument. 275 +detects a type size of 1, since the underlying element type is a single string, so the minimum number of strings is 1. But since it is a vector the expected number can be very big. The default for a vector is (1<<30), and the allow_extra_args is set to true. This means that at least 1 argument is expected to follow the option, but arbitrary numbers of arguments may follow. These are checked if they have the form of an option but if not they are added to the argument.
276 276
277 ```cpp 277 ```cpp
278 std::vector<std::tuple<int, double, std::string>> val; 278 std::vector<std::tuple<int, double, std::string>> val;
279 app.add_option("--opt",val,"description"); 279 app.add_option("--opt",val,"description");
280 ``` 280 ```
281 281
282 -gets into the complicated cases where the type size is now 3. and the expected max is set to a large number and `allow_extra_args` is set to true. In this case at least 3 arguments are required to follow the option, and subsequent groups must come in groups of three, otherwise an error will result. 282 +gets into the complicated cases where the type size is now 3. and the expected max is set to a large number and `allow_extra_args` is set to true. In this case at least 3 arguments are required to follow the option, and subsequent groups must come in groups of three, otherwise an error will result.
283 283
284 ```cpp 284 ```cpp
285 bool val{false}; 285 bool val{false};
@@ -293,7 +293,7 @@ std::complex&lt;double&gt; val; @@ -293,7 +293,7 @@ std::complex&lt;double&gt; val;
293 app.add_option("--opt",val,"description"); 293 app.add_option("--opt",val,"description");
294 ``` 294 ```
295 295
296 -triggers the complex number type which has a min of 1 and max of 2, so 1 or 2 strings can be passed. Complex number conversion supports arguments of the form "1+2j" or "1","2", or "1" "2i". The imaginary number symbols `i` and `j` are interchangeable in this context. 296 +triggers the complex number type which has a min of 1 and max of 2, so 1 or 2 strings can be passed. Complex number conversion supports arguments of the form "1+2j" or "1","2", or "1" "2i". The imaginary number symbols `i` and `j` are interchangeable in this context.
297 297
298 ```cpp 298 ```cpp
299 std::vector<std::vector<int>> val; 299 std::vector<std::vector<int>> val;
@@ -304,7 +304,7 @@ has a type size of 1 to (1&lt;&lt;30). @@ -304,7 +304,7 @@ has a type size of 1 to (1&lt;&lt;30).
304 304
305 ### Customization 305 ### Customization
306 306
307 -The `type_size(N)`, `type_size(Nmin, Nmax)`, `expected(N)`, `expected(Nmin,Nmax)`, and `allow_extra_args()` can be used to customize an option. For example 307 +The `type_size(N)`, `type_size(Nmin, Nmax)`, `expected(N)`, `expected(Nmin,Nmax)`, and `allow_extra_args()` can be used to customize an option. For example
308 308
309 ```cpp 309 ```cpp
310 std::string val; 310 std::string val;
@@ -316,12 +316,12 @@ will create a hybrid option, that can exist on its own in which case the value &quot; @@ -316,12 +316,12 @@ will create a hybrid option, that can exist on its own in which case the value &quot;
316 316
317 There are some additional options that can be specified to modify an option for specific cases: 317 There are some additional options that can be specified to modify an option for specific cases:
318 318
319 -* `->run_callback_for_default()` will specify that the callback should be executed when a default_val is set. This is set automatically when appropriate though it can be turned on or off and any user specified callback for an option will be executed when the default value for an option is set. 319 +- `->run_callback_for_default()` will specify that the callback should be executed when a default_val is set. This is set automatically when appropriate though it can be turned on or off and any user specified callback for an option will be executed when the default value for an option is set.
320 320
321 -* `->force_callback()` will for the callback/value assignment to run at the conclusion of parsing regardless of whether the option was supplied or not. This can be used to force the default or execute some code. 321 +- `->force_callback()` will for the callback/value assignment to run at the conclusion of parsing regardless of whether the option was supplied or not. This can be used to force the default or execute some code.
322 322
323 -* `->trigger_on_parse()` will trigger the callback or value assignment each time the argument is passed. The value is reset if the option is supplied multiple times. 323 +- `->trigger_on_parse()` will trigger the callback or value assignment each time the argument is passed. The value is reset if the option is supplied multiple times.
324 324
325 ## Unusual circumstances 325 ## Unusual circumstances
326 326
327 -There are a few cases where some things break down in the type system managing options and definitions. Using the `add_option` method defines a lambda function to extract a default value if required. In most cases this is either straightforward or a failure is detected automatically and handled. But in a few cases a streaming template is available that several layers down may not actually be defined. This results in CLI11 not being able to detect this circumstance automatically and will result in compile error. One specific known case is `boost::optional` if the boost optional_io header is included. This header defines a template for all boost optional values even if they do not actually have a streaming operator. For example `boost::optional<std::vector>` does not have a streaming operator but one is detected since it is part of a template. For these cases a secondary method `app->add_option_no_stream(...)` is provided that bypasses this operation completely and should compile in these cases. 327 +There are a few cases where some things break down in the type system managing options and definitions. Using the `add_option` method defines a lambda function to extract a default value if required. In most cases this is either straightforward or a failure is detected automatically and handled. But in a few cases a streaming template is available that several layers down may not actually be defined. This results in CLI11 not being able to detect this circumstance automatically and will result in compile error. One specific known case is `boost::optional` if the boost optional_io header is included. This header defines a template for all boost optional values even if they do not actually have a streaming operator. For example `boost::optional<std::vector>` does not have a streaming operator but one is detected since it is part of a template. For these cases a secondary method `app->add_option_no_stream(...)` is provided that bypasses this operation completely and should compile in these cases.
book/chapters/subcommands.md
@@ -73,20 +73,20 @@ example is shown below in the `geet` program. @@ -73,20 +73,20 @@ example is shown below in the `geet` program.
73 73
74 The following values are inherited when you add a new subcommand. This happens at the point the subcommand is created: 74 The following values are inherited when you add a new subcommand. This happens at the point the subcommand is created:
75 75
76 -* The name and description for the help flag  
77 -* The footer  
78 -* The failure message printer function  
79 -* Option defaults  
80 -* Allow extras  
81 -* Prefix command  
82 -* Ignore case  
83 -* Ignore underscore  
84 -* Allow Windows style options  
85 -* Fallthrough  
86 -* Group name  
87 -* Max required subcommands  
88 -* validate positional arguments  
89 -* validate optional arguments 76 +- The name and description for the help flag
  77 +- The footer
  78 +- The failure message printer function
  79 +- Option defaults
  80 +- Allow extras
  81 +- Prefix command
  82 +- Ignore case
  83 +- Ignore underscore
  84 +- Allow Windows style options
  85 +- Fallthrough
  86 +- Group name
  87 +- Max required subcommands
  88 +- validate positional arguments
  89 +- validate optional arguments
90 90
91 ## Special modes 91 ## Special modes
92 92
@@ -115,7 +115,7 @@ This is a special mode that allows &quot;prefix&quot; commands, where the parsing complete @@ -115,7 +115,7 @@ This is a special mode that allows &quot;prefix&quot; commands, where the parsing complete
115 115
116 ### Silent subcommands 116 ### Silent subcommands
117 117
118 -Subcommands can be modified by using the `silent` option. This will prevent the subcommand from showing up in the get_subcommands list. This can be used to make subcommands into modifiers. For example, a help subcommand might look like 118 +Subcommands can be modified by using the `silent` option. This will prevent the subcommand from showing up in the get_subcommands list. This can be used to make subcommands into modifiers. For example, a help subcommand might look like
119 119
120 ```c++ 120 ```c++
121 auto sub1 = app.add_subcommand("help")->silent(); 121 auto sub1 = app.add_subcommand("help")->silent();
@@ -131,7 +131,7 @@ This would allow calling help such as: @@ -131,7 +131,7 @@ This would allow calling help such as:
131 131
132 ### Positional Validation 132 ### Positional Validation
133 133
134 -Some arguments supplied on the command line may be legitamately applied to more than 1 positional argument. In this context enabling `positional_validation` on the application or subcommand will check any validators before applying the command line argument to the positional option. It is not an error to fail validation in this context, positional arguments not matching any validators will go into the `extra_args` field which may generate an error depending on settings. 134 +Some arguments supplied on the command line may be legitamately applied to more than 1 positional argument. In this context enabling `positional_validation` on the application or subcommand will check any validators before applying the command line argument to the positional option. It is not an error to fail validation in this context, positional arguments not matching any validators will go into the `extra_args` field which may generate an error depending on settings.
135 135
136 ### Optional Argument Validation 136 ### Optional Argument Validation
137 137
@@ -145,4 +145,4 @@ Similar to positional validation, there are occasional contexts in which case it @@ -145,4 +145,4 @@ Similar to positional validation, there are occasional contexts in which case it
145 app.validate_optional_arguments(); 145 app.validate_optional_arguments();
146 ``` 146 ```
147 147
148 -In this case a sequence of integers is expected for the argument and remaining strings go to the positional string vector. Without the `validate_optional_arguments()` active it would be impossible get any later arguments into the positional if the `--args` option is used. The validator in this context is used to make sure the optional arguments match with what the argument is expecting and if not the `-args` option is closed, and remaining arguments fall into the positional. 148 +In this case a sequence of integers is expected for the argument and remaining strings go to the positional string vector. Without the `validate_optional_arguments()` active it would be impossible get any later arguments into the positional if the `--args` option is used. The validator in this context is used to make sure the optional arguments match with what the argument is expecting and if not the `-args` option is closed, and remaining arguments fall into the positional.
book/chapters/validators.md
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 2
3 There are two forms of validators: 3 There are two forms of validators:
4 4
5 -* `transform` validators: mutating  
6 -* `check` validators: non-mutating (recommended unless the parsed string must be mutated) 5 +- `transform` validators: mutating
  6 +- `check` validators: non-mutating (recommended unless the parsed string must be mutated)
7 7
8 A transform validator comes in one form, a function with the signature `std::string(std::string)`. 8 A transform validator comes in one form, a function with the signature `std::string(std::string)`.
9 The function will take a string and return the modified version of the string. If there is an error, 9 The function will take a string and return the modified version of the string. If there is an error,
@@ -41,21 +41,21 @@ If you were not interested in the extra features of Validator, you could simply @@ -41,21 +41,21 @@ If you were not interested in the extra features of Validator, you could simply
41 41
42 The built-in validators for CLI11 are: 42 The built-in validators for CLI11 are:
43 43
44 -| Validator | Description |  
45 -|---------------------|-------------|  
46 -| `ExistingFile` | Check for existing file (returns error message if check fails) | 44 +| Validator | Description |
  45 +| ------------------- | ---------------------------------------------------------------------- |
  46 +| `ExistingFile` | Check for existing file (returns error message if check fails) |
47 | `ExistingDirectory` | Check for an existing directory (returns error message if check fails) | 47 | `ExistingDirectory` | Check for an existing directory (returns error message if check fails) |
48 -| `ExistingPath` | Check for an existing path |  
49 -| `NonexistentPath` | Check for an non-existing path |  
50 -| `Range(min=0, max)` | Produce a range (factory). Min and max are inclusive. | 48 +| `ExistingPath` | Check for an existing path |
  49 +| `NonexistentPath` | Check for an non-existing path |
  50 +| `Range(min=0, max)` | Produce a range (factory). Min and max are inclusive. |
51 51
52 And, the protected members that you can set when you make your own are: 52 And, the protected members that you can set when you make your own are:
53 53
54 -| Type | Member | Description |  
55 -|------|--------|-------------|  
56 -| `std::function<std::string(std::string &)>` | `func_` | Core validation function - modifies input and returns "" if successful |  
57 -| `std::function<std::string()>` | `desc_function` | Optional description function (uses `description_` instead if not set) |  
58 -| `std::string` | `name_` | The name for search purposes |  
59 -| `int` (`-1`) | `application_index_` | The element this validator applies to (-1 for all) |  
60 -| `bool` (`true`) | `active_` | This can be disabled |  
61 -| `bool` (`false`) | `non_modifying_` | Specify that this is a Validator instead of a Transformer | 54 +| Type | Member | Description |
  55 +| ------------------------------------------- | -------------------- | ---------------------------------------------------------------------- |
  56 +| `std::function<std::string(std::string &)>` | `func_` | Core validation function - modifies input and returns "" if successful |
  57 +| `std::function<std::string()>` | `desc_function` | Optional description function (uses `description_` instead if not set) |
  58 +| `std::string` | `name_` | The name for search purposes |
  59 +| `int` (`-1`) | `application_index_` | The element this validator applies to (-1 for all) |
  60 +| `bool` (`true`) | `active_` | This can be disabled |
  61 +| `bool` (`false`) | `non_modifying_` | Specify that this is a Validator instead of a Transformer |
docs/mainpage.md
@@ -4,19 +4,19 @@ This is the Doxygen API documentation for CLI11 parser. There is a friendly intr @@ -4,19 +4,19 @@ This is the Doxygen API documentation for CLI11 parser. There is a friendly intr
4 4
5 The main classes are: 5 The main classes are:
6 6
7 -| Name | Where used |  
8 -|---------------|-------------------------------------|  
9 -|CLI::Option | Options, stored in the app |  
10 -|CLI::App | The main application or subcommands |  
11 -|CLI::Validator | A check that can affect the type name |  
12 -|CLI::Formatter | A subclassable formatter for help printing |  
13 -|CLI::ExitCode | A scoped enum with exit codes |  
14 -|CLI::Timer | A timer class, only in CLI/Timer.hpp (not in `CLI11.hpp`) |  
15 -|CLI::AutoTimer | A timer that prints on deletion | 7 +| Name | Where used |
  8 +| -------------- | --------------------------------------------------------- |
  9 +| CLI::Option | Options, stored in the app |
  10 +| CLI::App | The main application or subcommands |
  11 +| CLI::Validator | A check that can affect the type name |
  12 +| CLI::Formatter | A subclassable formatter for help printing |
  13 +| CLI::ExitCode | A scoped enum with exit codes |
  14 +| CLI::Timer | A timer class, only in CLI/Timer.hpp (not in `CLI11.hpp`) |
  15 +| CLI::AutoTimer | A timer that prints on deletion |
16 16
17 Groups of related topics: 17 Groups of related topics:
18 18
19 | Name | Description | 19 | Name | Description |
20 -|----------------------|------------------------------------------------| 20 +| -------------------- | ---------------------------------------------- |
21 | @ref error_group | Errors that can be thrown | 21 | @ref error_group | Errors that can be thrown |
22 | @ref validator_group | Common validators used in CLI::Option::check() | 22 | @ref validator_group | Common validators used in CLI::Option::check() |