Skip to content
Snippets Groups Projects
Commit a3b573d7 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

git subrepo pull --force packages/CLI11

subrepo:
  subdir:   "packages/CLI11"
  merged:   "20de8b73b"
upstream:
  origin:   "git@github.com:CLIUtils/CLI11.git"
  branch:   "main"
  commit:   "20de8b73b"
git-subrepo:
  version:  "0.4.6"
  origin:   "git@github.com:ingydotnet/git-subrepo.git"
  commit:   "110b9eb"
parent 65932507
No related branches found
No related tags found
1 merge request!179git subrepo pull --force packages/CLI11
Showing
with 928 additions and 386 deletions
......@@ -476,8 +476,226 @@
"contributions": [
"code"
]
},
{
"login": "trokhymchuk",
"name": "Artem Trokhymchuk ",
"avatar_url": "https://avatars.githubusercontent.com/u/66204814?v=4",
"profile": "https://github.com/trokhymchuk",
"contributions": [
"code"
]
},
{
"login": "dherrera-fb",
"name": "dherrera-fb",
"avatar_url": "https://avatars.githubusercontent.com/u/89840711?v=4",
"profile": "https://github.com/dherrera-fb",
"contributions": [
"code"
]
},
{
"login": "VolkerChristian",
"name": "Volker Christian",
"avatar_url": "https://avatars.githubusercontent.com/u/18554540?v=4",
"profile": "https://github.com/VolkerChristian",
"contributions": [
"code"
]
},
{
"login": "thewtex",
"name": "Matt McCormick",
"avatar_url": "https://avatars.githubusercontent.com/u/25432?v=4",
"profile": "https://www.mmmccormick.com/",
"contributions": [
"code"
]
},
{
"login": "polistern",
"name": "polistern",
"avatar_url": "https://avatars.githubusercontent.com/u/55511995?v=4",
"profile": "http://polistern.i2p/",
"contributions": [
"code"
]
},
{
"login": "andreasxp",
"name": "Andrey Zhukov",
"avatar_url": "https://avatars.githubusercontent.com/u/28830446?v=4",
"profile": "https://github.com/andreasxp",
"contributions": [
"code"
]
},
{
"login": "SherlockInSpace",
"name": "Ryan Sherlock",
"avatar_url": "https://avatars.githubusercontent.com/u/5507786?v=4",
"profile": "https://github.com/SherlockInSpace",
"contributions": [
"code"
]
},
{
"login": "Krzmbrzl",
"name": "Robert Adam",
"avatar_url": "https://avatars.githubusercontent.com/u/12751591?v=4",
"profile": "https://github.com/Krzmbrzl",
"contributions": [
"code"
]
},
{
"login": "RangeMachine",
"name": "RangeMachine",
"avatar_url": "https://avatars.githubusercontent.com/u/11577601?v=4",
"profile": "https://github.com/RangeMachine",
"contributions": [
"code"
]
},
{
"login": "ptheywood",
"name": "Peter Heywood",
"avatar_url": "https://avatars.githubusercontent.com/u/628937?v=4",
"profile": "http://ptheywood.uk/",
"contributions": [
"code"
]
},
{
"login": "peterh",
"name": "Peter Harris",
"avatar_url": "https://avatars.githubusercontent.com/u/79339?v=4",
"profile": "https://github.com/peterh",
"contributions": [
"code"
]
},
{
"login": "PeteAudinate",
"name": "PeteAudinate",
"avatar_url": "https://avatars.githubusercontent.com/u/99274874?v=4",
"profile": "https://github.com/PeteAudinate",
"contributions": [
"code"
]
},
{
"login": "captainurist",
"name": "captainurist",
"avatar_url": "https://avatars.githubusercontent.com/u/73941350?v=4",
"profile": "https://github.com/captainurist",
"contributions": [
"code"
]
},
{
"login": "djerius",
"name": "djerius",
"avatar_url": "https://avatars.githubusercontent.com/u/196875?v=4",
"profile": "https://github.com/djerius",
"contributions": [
"code"
]
},
{
"login": "shameekganguly",
"name": "shameekganguly",
"avatar_url": "https://avatars.githubusercontent.com/u/2412842?v=4",
"profile": "https://github.com/shameekganguly",
"contributions": [
"code"
]
},
{
"login": "ayum",
"name": "ayum",
"avatar_url": "https://avatars.githubusercontent.com/u/6747040?v=4",
"profile": "https://github.com/ayum",
"contributions": [
"code"
]
},
{
"login": "BenjaminBeichler",
"name": "Benjamin Beichler",
"avatar_url": "https://avatars.githubusercontent.com/u/1441492?v=4",
"profile": "https://github.com/BenjaminBeichler",
"contributions": [
"code"
]
},
{
"login": "DarkWingMcQuack",
"name": "DarkWingMcQuack",
"avatar_url": "https://avatars.githubusercontent.com/u/38857302?v=4",
"profile": "https://github.com/DarkWingMcQuack",
"contributions": [
"code"
]
},
{
"login": "eli-schwartz",
"name": "Eli Schwartz",
"avatar_url": "https://avatars.githubusercontent.com/u/6551424?v=4",
"profile": "https://github.com/eli-schwartz",
"contributions": [
"code"
]
},
{
"login": "bruxisma",
"name": "Izzy Muerte",
"avatar_url": "https://avatars.githubusercontent.com/u/63051?v=4",
"profile": "https://izzys.casa/",
"contributions": [
"code"
]
},
{
"login": "j-rivero",
"name": "Jose Luis Rivero",
"avatar_url": "https://avatars.githubusercontent.com/u/2098802?v=4",
"profile": "https://github.com/j-rivero",
"contributions": [
"code"
]
},
{
"login": "looopTools",
"name": "Lars Nielsen",
"avatar_url": "https://avatars.githubusercontent.com/u/1943536?v=4",
"profile": "https://github.com/looopTools",
"contributions": [
"code"
]
},
{
"login": "cetius",
"name": "Marcin Ropa",
"avatar_url": "https://avatars.githubusercontent.com/u/6552472?v=4",
"profile": "https://github.com/cetius",
"contributions": [
"code"
]
},
{
"login": "nathanielhourt",
"name": "Nathaniel Hourt",
"avatar_url": "https://avatars.githubusercontent.com/u/271977?v=4",
"profile": "https://github.com/nathanielhourt",
"contributions": [
"code"
]
}
],
"contributorsSortAlphabetically": true,
"contributorsPerLine": 7,
"skipCi": true
"skipCi": true,
"commitType": "docs"
}
steps:
# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification
- bash: |
wget --no-check-certificate "https://cmake.org/files/v3.28/cmake-3.28.0-linux-x86_64.tar.gz"
echo "898f0b5ca6e2ea5286998e97bd33f030d7d09f18ca4b88be661fdfbad5dadd88 cmake-3.28.0-linux-x86_64.tar.gz" | shasum -sca 256
displayName: Download CMake
- task: ExtractFiles@1
inputs:
archiveFilePatterns: "cmake*.tar.gz"
destinationFolder: "cmake_program"
displayName: Extract CMake
- bash:
echo
"##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.28.0-linux-x86_64/bin"
displayName: Add CMake to PATH
......@@ -6,6 +6,7 @@
# modernize-avoid-c-arrays trips up in TEMPLATE_TEST_CASE catch macro
# modernize-return-braced-init-list triggers on lambdas ?
# modernize-make-unique requires C++14
# modernize-type_traits requires C++17
# readability-avoid-const-params-in-decls Affected by the pre-compile split
Checks: |
......@@ -37,6 +38,8 @@ Checks: |
-modernize-concat-nested-namespaces,
-modernize-return-braced-init-list,
-modernize-make-unique,
-modernize-type-traits,
-modernize-macro-to-enum,
*performance*,
-performance-unnecessary-value-param,
-performance-inefficient-string-concatenation,
......
---
engines:
rubocop:
enabled: true
duplication:
enabled: true
metrics:
enabled: true
coverage:
enabled: false
languages:
exclude_paths:
- "fuzz/**/*"
- "fuzz/*"
- "scripts/**/*"
- "scripts/*"
- "**.md"
name: Quick CMake config
description: "Runs CMake 3.4+ (if already setup)"
description: "Runs CMake 3.5+ (if already setup)"
inputs:
args:
description: "Other arguments"
......@@ -13,7 +13,7 @@ runs:
using: composite
steps:
- name: CMake ${{ inputs.cmake-version }}
uses: jwlawson/actions-setup-cmake@v1.13
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "${{ inputs.cmake-version }}"
- run: |
......
......@@ -7,3 +7,7 @@ updates:
interval: "weekly"
target-branch: "main"
open-pull-requests-limit: 10
groups:
actions:
patterns:
- "*"
......@@ -13,11 +13,11 @@ jobs:
name: Single header
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
......@@ -39,12 +39,12 @@ jobs:
- name: Copy file to main folder
run: cp build/include/CLI11.hpp CLI11.hpp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CLI11.hpp
path: CLI11.hpp
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: CLI11-Source
path: CLI11-Source
......
name: Docs
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
apidocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mattnotmitt/doxygen-action@v1
with:
doxyfile-path: ./docs/Doxyfile
- uses: actions/upload-artifact@v4
with:
name: api-docs
path: html
gitbook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: calibre calibre-bin libxss1 libasound2
version: 1
- name: Install JS requirements
working-directory: book
run: |
npm install
- name: Build book
working-directory: book
run: |
npx gitbook build . public
npx gitbook pdf . public/cli11.pdf
- uses: actions/upload-artifact@v4
with:
name: gitbook
path: book/public
pages:
runs-on: ubuntu-latest
needs: [apidocs, gitbook]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: >
success()
&& github.ref == 'refs/heads/main'
&& github.repository == 'CLIUtils/CLI11'
steps:
- uses: actions/configure-pages@v4
id: pages
- uses: actions/download-artifact@v4
with:
name: api-docs
path: _site
- uses: actions/download-artifact@v4
with:
name: gitbook
path: _site/book
- uses: actions/upload-pages-artifact@v3
- uses: actions/deploy-pages@v4
id: deployment
......@@ -16,7 +16,7 @@ jobs:
name: quickfuzz1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
......@@ -35,12 +35,12 @@ jobs:
- name: Build
run: cmake --build build -j4
- name: Test
- name: Test_app
run: |
cd build
make QUICK_CLI11_APP_FUZZ
- name: Test2
- name: Test_file
run: |
cd build
make QUICK_CLI11_FILE_FUZZ
......@@ -48,7 +48,7 @@ jobs:
- name: artifacts
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: file_failure
path: ./build/fuzz/cli11_*_fail_artifact.txt
......@@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
coverage:
name: Coverage
......@@ -19,7 +22,7 @@ jobs:
std: ["11", "14", "17", "20"]
precompile: ["ON", "OFF"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
......@@ -35,7 +38,7 @@ jobs:
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_EXAMPLES=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_PRECOMPILED=${{matrix.precompile}} \
-DCMAKE_BUILD_TYPE=Coverage
......@@ -55,15 +58,38 @@ jobs:
- uses: codecov/codecov-action@v3
with:
files: build/coverage.info
fail_ci_if_error: true
functionalities: fixes
catch2-3:
name: Catch 2 3.x
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Get Catch 2
run: brew install catch2
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=14 \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_PRECOMPILED=ON
- name: Build
run: cmake --build build -j4
- name: Test
run: cmake --build build --target test
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
container: silkeh/clang:14
container: silkeh/clang:17
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure
run: >
......@@ -81,7 +107,7 @@ jobs:
steps:
- name: Add build tools
run: apt-get update && apt-get install -y wget git cmake
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
......@@ -92,11 +118,11 @@ jobs:
cuda12-build:
name: CUDA 12 build only
runs-on: ubuntu-latest
container: nvidia/cuda:12.1.0-devel-ubuntu22.04
container: nvidia/cuda:12.3.1-devel-ubuntu22.04
steps:
- name: Add build tools
run: apt-get update && apt-get install -y wget git cmake
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
......@@ -106,9 +132,9 @@ jobs:
boost-build:
name: Boost build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Add boost
......@@ -127,7 +153,7 @@ jobs:
name: Meson build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare commands
run: |
......@@ -140,16 +166,62 @@ jobs:
- name: Build
run: meson compile -C build-meson
cmake-config-ubuntu-1804:
name: CMake config check (Ubuntu 18.04)
runs-on: ubuntu-18.04
install:
name: install tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install
- name: Build
run: cmake --build build -j2
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
- name: Check CMake 3.4
install-precompiled:
name: install tests precompiled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
cmake-version: "3.4"
uses: ./.github/actions/quick_cmake
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_PRECOMPILED=ON
- name: Build
run: cmake --build build -j2
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-single_file:
name: install tests single file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_SINGLE_FILE=ON
- name: Build
run: cmake --build build -j2
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
cmake-config-ubuntu-2004:
name: CMake config check (Ubuntu 20.04)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Check CMake 3.5
uses: ./.github/actions/quick_cmake
......@@ -187,17 +259,10 @@ jobs:
cmake-version: "3.10"
if: success() || failure()
cmake-config-ubuntu-2004:
name: CMake config check (Ubuntu 20.04)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Check CMake 3.11 (full)
- name: Check CMake 3.11
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.11"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.12
......@@ -216,6 +281,7 @@ jobs:
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.14"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.15
......@@ -234,7 +300,7 @@ jobs:
name: CMake config check (Ubuntu 22.04)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check CMake 3.17
uses: ./.github/actions/quick_cmake
......@@ -278,16 +344,34 @@ jobs:
cmake-version: "3.23"
if: success() || failure()
- name: Check CMake 3.24 (full)
- name: Check CMake 3.24
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.24"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.25 (full)
- name: Check CMake 3.25
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.25"
if: success() || failure()
- name: Check CMake 3.26 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.26"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.27
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.27"
if: success() || failure()
- name: Check CMake 3.28 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.28"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
......@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:CLIUtils/CLI11.git
branch = main
commit = 784fa3ebd387e63feef41d174f587bbe4cfec4da
parent = 164bbb3a73dc902c29aa7ccabfaba50cefa6345d
commit = 20de8b73bbbabaf2f94dd07c4ece8ff3590af531
parent = 65932507ed66da9e0ada0d9294a336690069148a
method = merge
cmdver = 0.4.6
......@@ -5,12 +5,12 @@ ci:
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
......@@ -26,7 +26,7 @@ repos:
- id: debug-statements
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.3
rev: v17.0.6
hooks:
- id: clang-format
types_or: [c++, c, cuda]
......@@ -38,7 +38,7 @@ repos:
additional_dependencies: [pyyaml]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
......@@ -87,7 +87,7 @@ repos:
exclude: .pre-commit-config.yaml
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.6
hooks:
- id: codespell
args: ["-L", "atleast,ans,doub,inout"]
......@@ -5,7 +5,7 @@
// This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts
// from: {git}
//
// CLI11 {version} Copyright (c) 2017-2023 University of Cincinnati, developed by Henry
// CLI11 {version} Copyright (c) 2017-2024 University of Cincinnati, developed by Henry
// Schreiner under NSF AWARD 1414736. All rights reserved.
//
// Redistribution and use in source and binary forms of CLI11, with or without
......
cmake_minimum_required(VERSION 3.4)
# Note: this is a header only library. If you have an older CMake than 3.4,
cmake_minimum_required(VERSION 3.5)
# Note: this is a header only library. If you have an older CMake than 3.5,
# just add the CLI11/include directory and that's all you need to do.
# Make sure users don't get warnings on a tested (3.4 to 3.24) version
# Make sure users don't get warnings on a tested (3.5 to 3.28) version
# of CMake. For most of the policies, the new version is better (hence the change).
# We don't use the 3.4...3.24 syntax because of a bug in an older MSVC's
# We don't use the 3.5...3.28 syntax because of a bug in an older MSVC's
# built-in and modified CMake 3.11
if(${CMAKE_VERSION} VERSION_LESS 3.25)
if(${CMAKE_VERSION} VERSION_LESS 3.28)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.25)
cmake_policy(VERSION 3.28)
endif()
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
......@@ -81,7 +81,7 @@ option(CLI11_WARNINGS_AS_ERRORS "Turn all warnings into errors (for CI)")
option(CLI11_SINGLE_FILE "Generate a single header file")
option(CLI11_PRECOMPILED "Generate a precompiled static library instead of a header-only" OFF)
cmake_dependent_option(CLI11_SANITIZERS "Download the sanitizers CMake config" OFF
"NOT CMAKE_VERSION VERSION_LESS 3.11" OFF)
"NOT CMAKE_VERSION VERSION_LESS 3.13" OFF)
cmake_dependent_option(CLI11_BUILD_DOCS "Build CLI11 documentation" ON "${build-docs}" OFF)
......@@ -198,6 +198,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND EXISTS "${CMAKE_CURRENT_SOURCE_D
endif()
# Packaging support
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CPACK_PACKAGE_VENDOR "github.com/CLIUtils/CLI11")
set(CPACK_PACKAGE_CONTACT "https://${CPACK_PACKAGE_VENDOR}")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) # Automatic in CMake 3.12+
......@@ -234,3 +235,4 @@ set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
set(CPACK_DEBIAN_PACKAGE_NAME "libcli11-dev")
include(CPack)
endif()
......@@ -9,6 +9,7 @@ filter=-readability/nolint # Conflicts with clang-tidy
filter=-readability/check # Catch uses CHECK(a == b) (Tests only)
filter=-build/namespaces # Currently using it for one test (Tests only)
filter=-runtime/references # Requires fundamental change of API, don't see need for this
filter=-runtime/string # Requires not using static const strings which makes thing really annoying
filter=-whitespace/blank_line # Unnecessarily strict with blank lines that otherwise help with readability
filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers
filter=-whitespace/parens,-whitespace/braces # Conflict with clang-format
CLI11 2.2 Copyright (c) 2017-2023 University of Cincinnati, developed by Henry
CLI11 2.2 Copyright (c) 2017-2024 University of Cincinnati, developed by Henry
Schreiner under NSF AWARD 1414736. All rights reserved.
Redistribution and use in source and binary forms of CLI11, with or without
......
This diff is collapsed.
......@@ -9,7 +9,6 @@ trigger:
pr:
- main
- "v*"
variables:
cli11.single: ON
......@@ -28,6 +27,20 @@ jobs:
- bash: cpplint --counting=detailed --recursive examples include/CLI tests
displayName: Checking against google style guide
- job: build_only
strategy:
matrix:
visual_studio_arm64:
vmImage: "windows-2022"
cli11.std: 17
cli11.build_type: Debug
cli11.options: -G "Visual Studio 17 2022" -A ARM64
pool:
vmImage: $(vmImage)
steps:
- template: .ci/azure-build.yml
- job: Native
strategy:
matrix:
......@@ -137,3 +150,28 @@ jobs:
- template: .ci/azure-cmake.yml
- template: .ci/azure-build.yml
- template: .ci/azure-test.yml
- job: Docker_new
variables:
cli11.single: OFF
pool:
vmImage: "ubuntu-latest"
strategy:
matrix:
gcc13:
containerImage: gcc:13
cli11.std: 17
cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5"
gcc12:
containerImage: gcc:12
cli11.std: 20
cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
clang17_20:
containerImage: silkeh/clang:17
cli11.std: 23
cli11.options: -DCMAKE_CXX_FLAGS=-std=c++23
container: $[ variables['containerImage'] ]
steps:
- template: .ci/azure-cmake-new.yml
- template: .ci/azure-build.yml
- template: .ci/azure-test.yml
......@@ -8,7 +8,9 @@ config flag. The second item is the default file name. If that is specified, the
config will try to read that file. The third item is the help string, with a
reasonable default, and the final argument is a boolean (default: false) that
indicates that the configuration file is required and an error will be thrown if
the file is not found and this is set to true.
the file is not found and this is set to true. The option pointer returned by
`set_config` is the same type as returned by `add_option` and all modifiers
including validators, and checks are valid.
### Adding a default path
......@@ -98,12 +100,29 @@ If it is needed to get the configuration file name used this can be obtained via
`app["--config"]->as<std::string>()` assuming `--config` was the configuration
option name.
### Order of precedence
By default if multiple configuration files are given they are read in reverse
order. With the last one given taking precedence over the earlier ones. This
behavior can be changed through the `multi_option_policy`. For example:
```cpp
app.set_config("--config")
->multi_option_policy(CLI::MultiOptionPolicy::TakeAll);
```
will read the files in the order given, which may be useful in some
circumstances. Using `CLI::MultiOptionPolicy::TakeLast` would work similarly
getting the last `N` files given. The default policy for config options is
`CLI::MultiOptionPolicy::Reverse` which takes the last expected `N` and reverses
them so the last option given is given precedence.
## Configure file format
Here is an example configuration file, in
[TOML](https://github.com/toml-lang/toml) format:
```ini
```toml
# Comments are supported, using a #
# The default section is [default], case insensitive
......@@ -148,6 +167,61 @@ 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.
### Multi-line strings
The default config file parser supports multi-line strings like the toml
standard [TOML](https://toml.io/en/). It also supports multiline comments like
python doc strings.
```toml
"""
this is a multine
comment
"""
""" this is also
a multiline comment"""
''' and so is
this
'''
value = 1
str = """
this is a multiline string value
the first \n is removed and so is the last
"""
str2 = ''' this is also a mu-
ltiline value '''
str3 = """\
a line continuation \
will skip \
all white space between the '\' \
and the next non-whitespace character \
making this into a single line
"""
```
The key is that the closing of the multiline string must be at the end of a line
and match the starting 3 quote sequence. Multiline sequences using `"""` allow
escape sequences. Following [TOML](https://toml.io/en/v1.0.0#string) with the
addition of allowing '\0' for a null character, and binary Strings described in
the next section. This same formatting also applies to single line strings.
Multiline strings are not allowed as part of an array.
### Binary Strings
Config files have a binary conversion capability, this is mainly to support
writing config files but can be used by user generated files as well. Strings
with the form `B"(XXXXX)"` will convert any characters inside the parenthesis
with the form `\xHH` to the equivalent binary value. The HH are hexadecimal
characters. Characters not in this form will be translated as given. If argument
values with unprintable characters are used to generate a config file this
binary form will be used in the output string.
## Multiple configuration files
If it is desired that multiple configuration be allowed. Use
......@@ -206,8 +280,8 @@ char arraySeparator = ',';
char valueDelimiter = '=';
/// the character to use around strings
char stringQuote = '"';
/// the character to use around single characters
char characterQuote = '\'';
/// the character to use around single characters and literal strings
char literalQuote = '\'';
/// the maximum number of layers to allow
uint8_t maximumLayers{255};
/// the separator used to separator parent layers
......@@ -228,8 +302,8 @@ These can be modified via setter functions
an array
- `ConfigBase *valueSeparator(char vSep)`: Specify the delimiter between a name
and value
- `ConfigBase *quoteCharacter(char qString, char qChar)` :specify the characters
to use around strings and single characters
- `ConfigBase *quoteCharacter(char qString, char literalChar)` :specify the
characters to use around strings and single characters
- `ConfigBase *maxLayers(uint8_t layers)` : specify the maximum number of parent
layers to process. This is useful to limit processing for larger config files
- `ConfigBase *parentSeparator(char sep)` : specify the character to separate
......@@ -342,3 +416,6 @@ will create an option name in following priority.
2. Positional name
3. First short name
4. Environment name
In config files the name will be enclosed in quotes if there is any potential
ambiguities in parsing the name.
......@@ -21,7 +21,7 @@ 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
given as a comma separated string, with the dash or dashes. A flag can have as
many names as you want, and afterward, using `count`, you can use any of the
names, with dashes as needed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment