diff --git a/.github/workflows/demo.yaml b/.github/workflows/demo.yaml
index 5667c22a..03ad961d 100644
--- a/.github/workflows/demo.yaml
+++ b/.github/workflows/demo.yaml
@@ -6,7 +6,7 @@ on:
paths:
- .github/workflows/demo.yaml
- .gitmodules
- - cpp-ap-demo
+ - cpp-argon-demo
- include/**
- CMakeLists.txt
- MODULE.bazel
@@ -17,7 +17,7 @@ on:
jobs:
build-demo-linux:
- name: Build cpp-ap-demo (Linux)
+ name: Build cpp-argon-demo (Linux)
runs-on: ubuntu-24.04
steps:
@@ -42,10 +42,10 @@ jobs:
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
fi
- - name: Build cpp-ap-demo (CMake)
+ - name: Build cpp-argon-demo (CMake)
run: |
- cd cpp-ap-demo
- cmake -B build_cmake -DAP_TAG=${{ steps.branch-name.outputs.branch }}
+ cd cpp-argon-demo
+ cmake -B build_cmake -DARGON_TAG=${{ steps.branch-name.outputs.branch }}
cmake --build build_cmake/ -j 4
- name: Setup Bazel
@@ -55,15 +55,15 @@ jobs:
disk-cache: ${{ github.workflow }}
repository-cache: true
- - name: Build cpp-ap-demo (Bazel)
+ - name: Build cpp-argon-demo (Bazel)
run: |
- cd cpp-ap-demo
+ cd cpp-argon-demo
BRANCH="${{ steps.branch-name.outputs.branch }}"
sed -i "s/branch = \".*\"/branch = \"$BRANCH\"/" MODULE.bazel
bazel build //:all_demos
build-demo-windows:
- name: Build cpp-ap-demo (Windows)
+ name: Build cpp-argon-demo (Windows)
runs-on: windows-2022
steps:
@@ -91,10 +91,10 @@ jobs:
"branch=$branch" >> $env:GITHUB_OUTPUT
}
- - name: Build cpp-ap-demo (CMake)
+ - name: Build cpp-argon-demo (CMake)
run: |
- cd cpp-ap-demo
- cmake -B build_cmake -DAP_TAG=${{ steps.branch-name.outputs.branch }}
+ cd cpp-argon-demo
+ cmake -B build_cmake -DARGON_TAG=${{ steps.branch-name.outputs.branch }}
cmake --build build_cmake/ --config Release -j 4
- name: Setup Bazel
@@ -104,9 +104,9 @@ jobs:
disk-cache: ${{ github.workflow }}
repository-cache: true
- - name: Build cpp-ap-demo (Bazel)
+ - name: Build cpp-argon-demo (Bazel)
run: |
- cd cpp-ap-demo
+ cd cpp-argon-demo
$BRANCH="${{ steps.branch-name.outputs.branch }}"
(Get-Content MODULE.bazel) -replace 'branch = ".*"', "branch = `"$BRANCH`"" | Set-Content MODULE.bazel
bazel build //:all_demos
diff --git a/.gitmodules b/.gitmodules
index b2d552dc..b9cf135d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,6 @@
-[submodule "cpp-ap-demo"]
- path = cpp-ap-demo
- url = https://github.com/SpectraL519/cpp-ap-demo.git
+[submodule "cpp-argon-demo"]
+ path = cpp-argon-demo
+ url = https://github.com/SpectraL519/cpp-argon-demo.git
[submodule "doxygen-awesome-css"]
path = doxygen-awesome-css
url = https://github.com/SpectraL519/doxygen-awesome-css.git
diff --git a/BUILD.bazel b/BUILD.bazel
index d0c641e9..bcb8e0f2 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,5 +1,5 @@
cc_library(
- name = "cpp-ap",
+ name = "cpp-argon",
hdrs = glob(["include/**/*.hpp"]),
includes = ["include"],
cxxopts = ["-std=c++20"],
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 639ac236..196029d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,15 @@
cmake_minimum_required(VERSION 3.12)
if (NOT DEFINED PROJECT_NAME)
- set(CPP_AP_IS_TOP_LEVEL_PROJECT ON)
+ set(CPP_ARGON_IS_TOP_LEVEL_PROJECT ON)
else()
- set(CPP_AP_IS_TOP_LEVEL_PROJECT OFF)
+ set(CPP_ARGON_IS_TOP_LEVEL_PROJECT OFF)
endif()
-project(cpp-ap
- VERSION 3.1.0
+project(cpp-argon
+ VERSION 4.0.0
DESCRIPTION "Command-line argument parser for C++20"
- HOMEPAGE_URL "https://github.com/SpectraL519/cpp-ap"
+ HOMEPAGE_URL "https://github.com/SpectraL519/cpp-argon"
LANGUAGES CXX
)
@@ -19,12 +19,12 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BUILD_TESTS "Build project tests" OFF)
# The library target
-add_library(cpp-ap INTERFACE)
-target_include_directories(cpp-ap INTERFACE
+add_library(cpp-argon INTERFACE)
+target_include_directories(cpp-argon INTERFACE
$
$
)
-set_target_properties(cpp-ap PROPERTIES
+set_target_properties(cpp-argon PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
)
@@ -33,49 +33,49 @@ set_target_properties(cpp-ap PROPERTIES
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
-set(INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/cpp-ap)
+set(INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/cpp-argon)
# Install the headers
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Install the library target
-install(TARGETS cpp-ap EXPORT cpp-ap-targets)
+install(TARGETS cpp-argon EXPORT cpp-argon-targets)
# Create a config file for find_package
configure_package_config_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpp-ap-config.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/cpp-ap-config.cmake
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpp-argon-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cpp-argon-config.cmake
INSTALL_DESTINATION ${INSTALL_DIR}
)
write_basic_package_version_file(
- ${CMAKE_CURRENT_BINARY_DIR}/cpp-ap-config-version.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cpp-argon-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY ExactVersion
)
install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/cpp-ap-config.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/cpp-ap-config-version.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cpp-argon-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cpp-argon-config-version.cmake
DESTINATION ${INSTALL_DIR}
)
-install(EXPORT cpp-ap-targets
- FILE cpp-ap-targets.cmake
- NAMESPACE cpp-ap::
+install(EXPORT cpp-argon-targets
+ FILE cpp-argon-targets.cmake
+ NAMESPACE cpp-argon::
DESTINATION ${INSTALL_DIR}
)
-# Include the tests directory if CPP-AP is a top-level project
-if (CPP_AP_IS_TOP_LEVEL_PROJECT AND BUILD_TESTS)
+# Include the tests directory if CPP-ARGON is a top-level project
+if (CPP_ARGON_IS_TOP_LEVEL_PROJECT AND BUILD_TESTS)
add_subdirectory(tests)
endif()
# Exporting from the build tree
-export(EXPORT cpp-ap-targets
- FILE ${CMAKE_CURRENT_BINARY_DIR}/cpp-ap-targets.cmake
- NAMESPACE cpp-ap::
+export(EXPORT cpp-argon-targets
+ FILE ${CMAKE_CURRENT_BINARY_DIR}/cpp-argon-targets.cmake
+ NAMESPACE cpp-argon::
)
-export(PACKAGE cpp-ap)
+export(PACKAGE cpp-argon)
diff --git a/Doxyfile b/Doxyfile
index c0ecdba9..7e2bfcd7 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -42,32 +42,32 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = CPP-AP
+PROJECT_NAME = CPP-ARGON
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 3.1.0
+PROJECT_NUMBER = 4.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF = "Command-line argument parser for C++20"
+PROJECT_BRIEF = "Command-Line Argument Parser for C++20"
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO = "docs/img/cpp-argon-hex.png"
# With the PROJECT_ICON tag one can specify an icon that is included in the tabs
# when the HTML document is shown. Doxygen will copy the logo to the output
# directory.
-PROJECT_ICON =
+PROJECT_ICON = "docs/img/cpp-argon-hex.png"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
diff --git a/LICENSE.md b/LICENSE.md
index 5a15f331..13dd8191 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,7 +1,7 @@
#### MIT License
-Copyright (c) 2023-2025 Jakub Musiał and other contributors
-https://github.com/SpectraL519/cpp-ap
+Copyright (c) 2023-2026 Jakub Musiał and other contributors
+https://github.com/SpectraL519/cpp-argon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/MODULE.bazel b/MODULE.bazel
index ee564582..f8f82ee4 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,4 +1,4 @@
module(
- name = "cpp-ap",
- version = "3.1.0",
+ name = "cpp-argon",
+ version = "4.0.0",
)
diff --git a/README.md b/README.md
index 60bddaea..86d3f57a 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,25 @@
-
-
-Command-line argument parser for C++20
+
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/gcc)
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/clang)
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/msvc)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/gcc)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/clang)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/msvc)
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/format)
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/demo)
-[](https://github.com/SpectraL519/cpp-ap/actions/workflows/documentation)
-[](https://github.com/SpectraL519/cpp-ap/releases)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/format)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/demo)
+[](https://github.com/SpectraL519/cpp-argon/actions/workflows/documentation)
+[](https://github.com/SpectraL519/cpp-argon/releases)
@@ -30,11 +27,23 @@ Command-line argument parser for C++20
## Overview
-`CPP-AP` is a lightweight and feature-rich command-line argument parsing library for the C++20 and newer standards, designed as an alternative to `boost::program_options`. It offers a modern and intuitive interface allowing for straightforward argument configuration and parsing.
+`CPP-ARGON` is a lightweight and feature-rich command-line argument parsing library for the C++20 and newer standards, designed as an alternative to `boost::program_options`. It offers a modern and intuitive interface allowing for straightforward argument configuration and parsing.
+
+> [!CAUTION]
+> Versions of the `CPP-ARGON` library up to prior to `v4.0.0` were developed under the name `CPP-AP`.
+>
+> **Legacy Support:** The deprecated URLs (`https://github.com/SpectraL519/cpp-ap` and `.../cpp-ap-demo`) automatically redirect to the new locations, and build targets defined in previous versions remain fully functional.
+>
+> **Action Required:**
+> - **Repositories:** We highly recommend updating your remote references and submodules to the new canonical URLs:
+> - Library: https://github.com/SpectraL519/cpp-argon
+> - Demo: https://github.com/SpectraL519/cpp-argon-demo
+> - **Documentation:** The old documentation URL (`.../cpp-ap//`) is **no longer active**. Please use the new address:
+> - https://spectral519.github.io/cpp-argon/latest/
> [!NOTE]
>
-> [v1.0](https://github.com/SpectraL519/cpp-ap/releases/tag/v1.0) of the library has been developed for the *Team Programming* course at the *Wrocław University of Science and Technology*.
+> [v1.0](https://github.com/SpectraL519/cpp-argon/releases/tag/v1.0) of the library has been developed for the *Team Programming* course at the *Wrocław University of Science and Technology*.
>
> Faculty: *W04N - Faculty of Information and Communication Technology*
>
@@ -47,7 +56,7 @@ Command-line argument parser for C++20
## Related Pages
- [Tutorial](/docs/tutorial.md#tutorial)
- - [Setting Up CPP-AP](/docs/tutorial.md#setting-up-cpp-ap)
+ - [Setting Up CPP-ARGON](/docs/tutorial.md#setting-up-cpp-argon)
- [CMake Integration](/docs/tutorial.md#cmake-integration)
- [Bazel Build System](/docs/tutorial.md#bazel-build-system)
- [Downloading the Library](/docs/tutorial.md#downloading-the-library)
@@ -99,4 +108,4 @@ Command-line argument parser for C++20
## License
-The `CPP-AP` project uses the [MIT License](https://mit-license.org/) which can be found in the [LICENSE](/LICENSE.md#mit-license) file
+The `CPP-ARGON` project uses the [MIT License](https://mit-license.org/) which can be found in the [LICENSE](/LICENSE.md#mit-license) file
diff --git a/cmake/cpp-ap-config.cmake.in b/cmake/cpp-ap-config.cmake.in
deleted file mode 100644
index cf97c931..00000000
--- a/cmake/cpp-ap-config.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-@PACKAGE_INIT@
-
-include(CMakeFindDependencyMacro)
-
-set_and_check(CPP_AP_INCLUDE_DIR "@PACKAGE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")
-
-include("${CMAKE_CURRENT_LIST_DIR}/cpp-ap-targets.cmake")
diff --git a/cmake/cpp-argon-config.cmake.in b/cmake/cpp-argon-config.cmake.in
new file mode 100644
index 00000000..bb5e5f7f
--- /dev/null
+++ b/cmake/cpp-argon-config.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+set_and_check(CPP_ARGON_INCLUDE_DIR "@PACKAGE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@")
+
+include("${CMAKE_CURRENT_LIST_DIR}/cpp-argon-targets.cmake")
diff --git a/cpp-ap-demo b/cpp-ap-demo
deleted file mode 160000
index cf3f2ad8..00000000
--- a/cpp-ap-demo
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit cf3f2ad8e9c06af9adcde99288eea517bfb6ecae
diff --git a/cpp-argon-demo b/cpp-argon-demo
new file mode 160000
index 00000000..aa2b9609
--- /dev/null
+++ b/cpp-argon-demo
@@ -0,0 +1 @@
+Subproject commit aa2b9609d63ef673d60d37b6c2e5b80201d748cb
diff --git a/docs/dev_notes.md b/docs/dev_notes.md
index 5a360f26..c31ed855 100644
--- a/docs/dev_notes.md
+++ b/docs/dev_notes.md
@@ -65,11 +65,11 @@ python scripts/format.py --help
> [!NOTE]
>
-> You can view the online documentation for the latest version [here](https://spectral519.github.io/cpp-ap/latest/).
+> You can view the online documentation for the latest version [here](https://spectral519.github.io/cpp-argon/latest/).
>
> To view the documentation for the previous versions use the following URL pattern:
> ```
-> https://spectral519.github.io/cpp-ap/
+> https://spectral519.github.io/cpp-argon/
> ```
The documentation for this project can be generated using Doxygen, styled with a custom [fork](https://github.com/SpectraL519/doxygen-awesome-css/tree/theme-alignment) of the [doxygen-awesome-css](https://github.com/jothepro/doxygen-awesome-css) theme.
diff --git a/docs/img/cpp-argon-hex.png b/docs/img/cpp-argon-hex.png
new file mode 100644
index 00000000..51bb15ec
Binary files /dev/null and b/docs/img/cpp-argon-hex.png differ
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 259fa2bd..31fcc029 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -1,6 +1,6 @@
# Tutorial
-- [Setting Up CPP-AP](#setting-up-cpp-ap)
+- [Setting Up CPP-ARGON](#setting-up-cpp-argon)
- [CMake Integration](#cmake-integration)
- [Bazel Build System](#bazel-build-system)
- [Downloading the Library](#downloading-the-library)
@@ -55,7 +55,7 @@
-## Setting Up CPP-AP
+## Setting Up CPP-ARGON
### CMake Integration
@@ -69,14 +69,14 @@ project(my_project LANGUAGES CXX)
# Include FetchContent module
include(FetchContent)
-# Fetch CPP-AP library
+# Fetch CPP-ARGON library
FetchContent_Declare(
- cpp-ap
- GIT_REPOSITORY https://github.com/SpectraL519/cpp-ap.git
- GIT_TAG master # here you can specify the desired tag or branch name
+ cpp-argon
+ GIT_REPOSITORY https://github.com/SpectraL519/cpp-argon.git
+ GIT_TAG master # here you can specify the desired tag or branch name (use `master` for the latest version)
)
-FetchContent_MakeAvailable(cpp-ap)
+FetchContent_MakeAvailable(cpp-argon)
# Define the executable for the project
add_executable(my_project main.cpp)
@@ -86,28 +86,28 @@ set_target_properties(my_project PROPERTIES
CXX_STANDARD_REQUIRED YES
)
-# Link against the cpp-ap library
-target_link_libraries(my_project PRIVATE cpp-ap)
+# Link against the cpp-argon library
+target_link_libraries(my_project PRIVATE cpp-argon)
```
### Bazel Build System
-To use the `CPP-AP` in a [Bazel](https://bazel.build/) project add the following in the `MODULE.bazel` (or `WORKSPACE.bazel`) file:
+To use the `CPP-ARGON` in a [Bazel](https://bazel.build/) project add the following in the `MODULE.bazel` (or `WORKSPACE.bazel`) file:
```bazel
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
- name = "cpp-ap",
- remote = "https://github.com/SpectraL519/cpp-ap.git",
- tag = "" # here you can declare the desired CPP-AP version
+ name = "cpp-argon",
+ remote = "https://github.com/SpectraL519/cpp-argon.git",
+ tag = "" # here you can declare the desired CPP-ARGON version
)
```
> [!IMPORTANT]
-> CPP-AP versions older than [2.5.0](https://github.com/SpectraL519/cpp-ap/releases/tag/v2.5.0) do not support building with Bazel.
+> CPP-ARGON (CPP-AP) versions older than [2.5.0](https://github.com/SpectraL519/cpp-argon/releases/tag/v2.5.0) do not support building with Bazel.
-And then add the `"@cpp-ap//:cpp-ap"` dependency for the target you want to use `CPP-AP` for by adding it to the `deps` list. For instance:
+And then add the `"@cpp-argon//:cpp-argon"` dependency for the target you want to use `CPP-ARGON` for by adding it to the `deps` list. For instance:
```bazel
# BUILD.bazel
@@ -115,7 +115,7 @@ cc_binary(
name = "my_app",
srcs = ["application.cpp"],
includes = ["include"],
- deps = ["@cpp-ap//:cpp-ap"],
+ deps = ["@cpp-argon//:cpp-argon"],
cxxopts = ["-std=c++20"],
visibility = ["//visibility:public"],
)
@@ -123,7 +123,7 @@ cc_binary(
### Downloading the Library
-If you do not use CMake, you can download the desired [library release](https://github.com/SpectraL519/cpp-ap/releases), extract it in a desired directory and simply add `/include` to the include directories of your project.
+If you do not use CMake, you can download the desired [library release](https://github.com/SpectraL519/cpp-argon/releases), extract it in a desired directory and simply add `/include` to the include directories of your project.
@@ -131,10 +131,10 @@ If you do not use CMake, you can download the desired [library release](https://
## The Parser Class
-To use the argument parser in your code you need to use the `ap::argument_parser` class.
+To use the argument parser in your code you need to use the `argon::argument_parser` class.
```cpp
-ap::argument_parser parser("program");
+argon::argument_parser parser("program");
parser.program_version("alpha")
.program_description("Description of the program")
.verbose();
@@ -155,16 +155,16 @@ parser.program_version("alpha")
> [!TIP]
>
-> You can specify the program version using a string (like in the example above) or using the `ap::version` structure:
+> You can specify the program version using a string (like in the example above) or using the `argon::version` structure:
>
> ```cpp
> parser.program_version({0u, 0u, 0u})
> parser.program_version({ .major = 1u, .minor = 1u, .patch = 1u });
-> ap::version ver{2u, 2u, 2u};
+> argon::version ver{2u, 2u, 2u};
> parser.program_version(ver);
> ```
>
-> **NOTE:** The `ap::version` struct
+> **NOTE:** The `argon::version` struct
> - contains the three members - `major`, `minor`, `patch` - all of which are of type `std::uint32_t`,
> - defines a `std::string str() const` method which returns a `v{major}.{minor}.{path}` version string,
> - defines the `std::ostream& operator<<` for stream insertion.
@@ -199,7 +199,7 @@ parser.add_optional_argument("name", "n")
or use only the secondary name:
```cpp
-parser.add_optional_argument("n", ap::n_secondary);
+parser.add_optional_argument("n", argon::n_secondary);
```
### Names
@@ -213,7 +213,7 @@ parser.add_optional_argument("n", ap::n_secondary);
### Value Types
> [!IMPORTANT]
-> An argument's value type must be `ap::none_type` **or** satisfy all of the following requirements:
+> An argument's value type must be `argon::none_type` **or** satisfy all of the following requirements:
>
> - [Constructible from](https://en.cppreference.com/w/cpp/concepts/constructible_from) `const std::string&` or overload `std::istream& operator>>`.
> - The parser will always try direct initialization from std::string first, and only fall back to the extraction operator if direct initialization fails.
@@ -222,7 +222,7 @@ parser.add_optional_argument("n", ap::n_secondary);
> [!NOTE]
>
> - The default value type of any argument is `std::string`.
-> - If the argument's value type is `ap::none_type`, the argument will not accept any values and therefore no value-related parameters can be set for such argument. This includes:
+> - If the argument's value type is `argon::none_type`, the argument will not accept any values and therefore no value-related parameters can be set for such argument. This includes:
> - [nargs](#5-nargs---sets-the-allowed-number-of-values-to-be-parsed-for-an-argument)
> - [greedy](#6-greedy---if-this-option-is-set-the-argument-will-consume-all-command-line-values-until-its-upper-nargs-bound-is-reached)
> - [choices](#7-choices---a-list-of-valid-argument-values)
@@ -283,9 +283,9 @@ parser.add_positional_argument("number", "n")
By default all arguments are visible, but this can be modified using the `hidden(bool)` setter as follows:
```cpp
-ap::argument_parser("hidden-test")
+argon::argument_parser("hidden-test")
parser.program_description("A simple test program for argument hiding")
- .default_arguments(ap::default_argument::o_help);
+ .default_arguments(argon::default_argument::o_help);
parser.add_optional_argument("hidden")
.hidden()
@@ -405,11 +405,11 @@ if (parser.count("version")) {
std::exit(EXIT_SUCCESS);
}
-// may result in an `ap::argument_parser_exception`:
+// may result in an `argon::argument_parser_exception`:
// `input` is not guaranteed to have a value at this point
const auto data = read_data(parser.value("input"));
-// may result in an `ap::argument_parser_exception`:
+// may result in an `argon::argument_parser_exception`:
// `output` is not guaranteed to have a value at this point
std::ofstream os(parser.value("output"));
os << data << std::endl;
@@ -436,25 +436,25 @@ The `nargs` parameter can be set as:
- Partially bound range:
```cpp
- parser.add_optional_argument("input", "i").nargs(ap::nargs::at_least(1)); // n >= 1
- parser.add_optional_argument("input", "i").nargs(ap::nargs::more_than(1)); // n > 1
- parser.add_optional_argument("input", "i").nargs(ap::nargs::less_than(5)); // n < 5
- parser.add_optional_argument("input", "i").nargs(ap::nargs::up_to(5)); // n <= 5
+ parser.add_optional_argument("input", "i").nargs(argon::nargs::at_least(1)); // n >= 1
+ parser.add_optional_argument("input", "i").nargs(argon::nargs::more_than(1)); // n > 1
+ parser.add_optional_argument("input", "i").nargs(argon::nargs::less_than(5)); // n < 5
+ parser.add_optional_argument("input", "i").nargs(argon::nargs::up_to(5)); // n <= 5
```
- Unbound range:
```cpp
- parser.add_optional_argument("input", "i").nargs(ap::nargs::any());
+ parser.add_optional_argument("input", "i").nargs(argon::nargs::any());
```
> [!IMPORTANT]
>
> The default `nargs` parameter value is:
>
-> - `ap::nargs::range(1ull)` for positional arguments
+> - `argon::nargs::range(1ull)` for positional arguments
>
-> - `ap::nargs::any()` for optional arguments
+> - `argon::nargs::any()` for optional arguments
@@ -473,8 +473,8 @@ The `nargs` parameter can be set as:
Consider a simple example:
```cpp
-ap::argument_parser parser("run-script");
-parser.default_arguments(ap::default_argument::o_help);
+argon::argument_parser parser("run-script");
+parser.default_arguments(argon::default_argument::o_help);
parser.add_positional_argument("script")
.help("The name of the script to run");
@@ -485,7 +485,7 @@ parser.add_optional_argument("args")
parser.try_parse_args(argc, argv);
// Application logic here
-std::cout << "Executing: " << parser.value("script") << " " << ap::util::join(parser.values("args")) << std::endl;
+std::cout << "Executing: " << parser.value("script") << " " << argon::util::join(parser.values("args")) << std::endl;
```
Here the program execution should look something like this:
@@ -528,7 +528,7 @@ Actions are represented as functions, which take the argument's value as an argu
}
parser.add_optional_argument("user", "u")
- .action(is_valid_user_tag);
+ .action(is_valid_user_tag);
```
- `transform` actions | `value_type(const value_type&)` - applied to the parsed value. The returned value will be used to initialize the argument's value.
@@ -541,7 +541,7 @@ Actions are represented as functions, which take the argument's value as an argu
}
parser.add_optional_argument("key", "k")
- .action(to_lower);
+ .action(to_lower);
```
- `modify` actions | `void(value_type&)` - applied to the initialized value of an argument.
@@ -552,7 +552,7 @@ Actions are represented as functions, which take the argument's value as an argu
}
parser.add_optional_argument("name", "n")
- .action(capitalize);
+ .action(capitalize);
```
> [!TIP]
@@ -637,7 +637,7 @@ void print_debug_info() noexcept {
};
parser.add_optional_argument("debug-info")
- .action(print_debug_info);
+ .action(print_debug_info);
```
Here the `print_debug_info` function will be called right after parsing the `--debug-info` flag and the program will exit, even if there are more arguments after this flag.
@@ -691,8 +691,8 @@ Command Result
Prints the parser's help message to the output stream and optionally exits with the given code.
```cpp
- typename ap::action_type::on_flag::type print_help(
- const ap::argument_parser& parser,
+ typename argon::action_type::on_flag::type print_help(
+ const argon::argument_parser& parser,
const std::optional exit_code = std::nullopt,
std::ostream& os = std::cout
) noexcept;
@@ -703,7 +703,7 @@ Command Result
Throws if the provided file path does not exist.
```cpp
- ap::action::util::callable_type check_file_exists() noexcept;
+ argon::action::util::callable_type check_file_exists() noexcept;
```
- `gt` | observe (value type: [arithmetic](https://en.cppreference.com/w/cpp/types/is_arithmetic))
@@ -711,8 +711,8 @@ Command Result
Validates that the value is strictly greater than `lower_bound`.
```cpp
- template
- ap::action::util::callable_type gt(const T lower_bound) noexcept;
+ template
+ argon::action::util::callable_type gt(const T lower_bound) noexcept;
```
- `geq` | observe (value type: [arithmetic](https://en.cppreference.com/w/cpp/types/is_arithmetic))
@@ -720,8 +720,8 @@ Command Result
Validates that the value is greater than or equal to `lower_bound`.
```cpp
- template
- ap::action::util::callable_type geq(const T lower_bound) noexcept;
+ template
+ argon::action::util::callable_type geq(const T lower_bound) noexcept;
```
- `lt` | observe (value type: [arithmetic](https://en.cppreference.com/w/cpp/types/is_arithmetic))
@@ -729,8 +729,8 @@ Command Result
Validates that the value is strictly less than `upper_bound`.
```cpp
- template
- ap::action::util::callable_type lt(const T upper_bound) noexcept;
+ template
+ argon::action::util::callable_type lt(const T upper_bound) noexcept;
```
- `leq` | observe (value type: [arithmetic](https://en.cppreference.com/w/cpp/types/is_arithmetic))
@@ -738,8 +738,8 @@ Command Result
Validates that the value is less than or equal to `upper_bound`.
```cpp
- template
- ap::action::util::callable_type leq(const T upper_bound) noexcept;
+ template
+ argon::action::util::callable_type leq(const T upper_bound) noexcept;
```
- `within` | observe (value type: [arithmetic](https://en.cppreference.com/w/cpp/types/is_arithmetic))
@@ -747,8 +747,8 @@ Command Result
Checks if the value is within the given interval. Bound inclusivity is customizable using template parameters.
```cpp
- template
- ap::action::util::callable_type within(
+ template
+ argon::action::util::callable_type within(
const T lower_bound, const T upper_bound
) noexcept;
```
@@ -759,7 +759,7 @@ Command Result
## Default Arguments
-The `CPP-AP` library defines several default arguments, which can be added to the parser's configuration as follows.
+The `CPP-ARGON` library defines several default arguments, which can be added to the parser's configuration as follows.
```cpp
parser.default_arguments();
@@ -768,15 +768,15 @@ parser.default_arguments();
> [!NOTE]
>
> The `default_arguments` function can be called with:
-> - A variadic number of `ap::default_argument` values
-> - An arbitrary [`std::ranges::range`](https://en.cppreference.com/w/cpp/ranges/range.html) type with the `ap::default_argument` value type
+> - A variadic number of `argon::default_argument` values
+> - An arbitrary [`std::ranges::range`](https://en.cppreference.com/w/cpp/ranges/range.html) type with the `argon::default_argument` value type
- `p_input`:
```cpp
// equivalent to:
parser.add_positional_argument("input")
- .action(ap::action::check_file_exists())
+ .action(argon::action::check_file_exists())
.help("Input file path");
```
@@ -791,8 +791,8 @@ parser.default_arguments();
```cpp
// equivalent to:
- parser.add_optional_argument("help", "h")
- .action(ap::action::print_help(parser, EXIT_SUCCESS))
+ parser.add_optional_argument("help", "h")
+ .action(argon::action::print_help(parser, EXIT_SUCCESS))
.help("Display the help message");
```
@@ -815,14 +815,14 @@ parser.default_arguments();
parser.add_optional_argument("input", "i")
.required()
.nargs(1)
- .action(ap::action::check_file_exists())
+ .action(argon::action::check_file_exists())
.help("Input file path");
// multi_input - equivalent to:
parser.add_optional_argument("input", "i")
.required()
- .nargs(ap::nargs::at_least(1))
- .action(ap::action::check_file_exists())
+ .nargs(argon::nargs::at_least(1))
+ .action(argon::action::check_file_exists())
.help("Input files paths");
```
@@ -838,7 +838,7 @@ parser.default_arguments();
// multi_output - equivalent to:
parser.add_optional_argument("output", "o")
.required()
- .nargs(ap::nargs::at_least(1))
+ .nargs(argon::nargs::at_least(1))
.help("Output files paths");
```
@@ -864,7 +864,7 @@ By default, every parser comes with two predefined groups:
A new group can be created by calling the `add_group` method of an argument parser:
```cpp
-ap::argument_parser parser("myprog");
+argon::argument_parser parser("myprog");
auto& out_opts = parser.add_group("Output Options");
```
@@ -922,11 +922,11 @@ In the example above, neither the `Hidden Options` group nor the `visible` arg w
Below is a small program that demonstrates how to use a mutually exclusive group of required arguments:
```cpp
-#include
+#include
int main(int argc, char* argv[]) {
- ap::argument_parser parser("myprog");
- parser.default_arguments(ap::default_argument::o_help);
+ argon::argument_parser parser("myprog");
+ parser.default_arguments(argon::default_argument::o_help);
// create the argument group
auto& out_opts = parser.add_group("Output Options")
@@ -998,7 +998,7 @@ The `argument_parser` class also defines the `void parse_args(int argc, char* ar
> [!TIP]
>
-> The `parse_args` function may throw an `ap::argument_parser_exception` if the configuration of the defined arguments is invalid or the parsed command-line arguments do not match the expected configuration. To simplify error handling, the `argument_parser` class provides a `try_parse_args` method which will automatically catch these exceptions, print the error message as well as the help message of the deepest used parser (see [Subparsers](#subparsers)), and exit with a failure status.
+> The `parse_args` function may throw an `argon::argument_parser_exception` if the configuration of the defined arguments is invalid or the parsed command-line arguments do not match the expected configuration. To simplify error handling, the `argument_parser` class provides a `try_parse_args` method which will automatically catch these exceptions, print the error message as well as the help message of the deepest used parser (see [Subparsers](#subparsers)), and exit with a failure status.
>
> Internally, This is equivalent to:
>
@@ -1006,8 +1006,8 @@ The `argument_parser` class also defines the `void parse_args(int argc, char* ar
> try {
> parser.parse_args(...);
> }
-> catch (const ap::argument_parser_exception& err) {
-> std::cerr << "[ap::error] " << err.what() << std::endl << parser.resolved_parser() << std::endl;
+> catch (const argon::argument_parser_exception& err) {
+> std::cerr << "[argon::error] " << err.what() << std::endl << parser.resolved_parser() << std::endl;
> std::exit(EXIT_FAILURE);
> }
> ```
@@ -1016,16 +1016,16 @@ The simple example below demonstrates how (in terms of the program's structure)
```cpp
// include the main library header
-#include
+#include
int main(int argc, char* argv[]) {
// create the parser class instance
- ap::argument_parser parser("some-program");
+ argon::argument_parser parser("some-program");
// define the parser's attributes and default arguments
parser.program_version({0u, 0u, 0u})
.program_description("The program does something with command-line arguments")
- .default_arguments(ap::default_argument::o_help);
+ .default_arguments(argon::default_argument::o_help);
// define the program arguments
parser.add_positional_argument("positional").help("A positional argument");
@@ -1037,7 +1037,7 @@ int main(int argc, char* argv[]) {
// use the program's arguments
std::cout << "positional: " << parser.value("positional") << std::endl
- << "optional: " << ap::util::join(parser.values("optional")) << std::endl
+ << "optional: " << argon::util::join(parser.values("optional")) << std::endl
<< "flag: " << std::boolalpha << parser.value("flag") << std::endl;
return 0;
@@ -1069,8 +1069,8 @@ Here, the argument is parsed only if either `--optional` (primary flag) or `-o`
>
> parser.try_parse_args(argc, argv);
>
-> std::cout << "first: " << ap::util::join(parser.values("first")) << std::endl
-> << "second: " << ap::util::join(parser.values("second")) << std::endl;
+> std::cout << "first: " << argon::util::join(parser.values("first")) << std::endl
+> << "second: " << argon::util::join(parser.values("second")) << std::endl;
>
> /* Example execution:
> > ./program --first value1 value2 --second value3 value4
@@ -1084,7 +1084,7 @@ Here, the argument is parsed only if either `--optional` (primary flag) or `-o`
>
> ```cpp
> parser.add_optional_argument("numbers", "n")
-> .nargs(ap::nargs::up_to(3))
+> .nargs(argon::nargs::up_to(3))
> .help("A list of numbers");
> ```
> ```txt
@@ -1180,33 +1180,33 @@ This behavior can be modified using the `unknown_arguments_policy` method of the
**Example:**
```cpp
-#include
+#include
int main(int argc, char* argv[]) {
- ap::argument_parser parser("unknown-policy-test");
+ argon::argument_parser parser("unknown-policy-test");
parser.program_description("A simple test program for unknwon argument handling policies")
- .default_arguments(ap::default_argument::o_help)
+ .default_arguments(argon::default_argument::o_help)
// set the unknown argument flags handling policy
- .unknown_arguments_policy(ap::unknown_policy::);
+ .unknown_arguments_policy(argon::unknown_policy::);
parser.add_optional_argument("known", "k")
.help("A known optional argument");
parser.try_parse_args(argc, argv);
- std::cout << "known = " << ap::util::join(parser.values("known")) << std::endl;
+ std::cout << "known = " << argon::util::join(parser.values("known")) << std::endl;
return 0;
}
```
The available policies are:
-- `ap::unknown_policy::fail` (default) - throws an exception if an unknown argument flag is encountered:
+- `argon::unknown_policy::fail` (default) - throws an exception if an unknown argument flag is encountered:
```txt
> ./unknown-policy-test --known --unknown
- [ap::error] Unknown argument [--unknown].
+ [argon::error] Unknown argument [--unknown].
Program: unknown-policy-test
A simple test program for unknwon argument handling policies
@@ -1217,22 +1217,22 @@ The available policies are:
--known, -k : A known optional argument
```
-- `ap::unknown_policy::warn` - prints a warning message to the standard error stream and continues parsing the remaining arguments:
+- `argon::unknown_policy::warn` - prints a warning message to the standard error stream and continues parsing the remaining arguments:
```txt
> ./unknown-policy-test --known --unknown
- [ap::warning] Unknown argument '--unknown' will be ignored.
+ [argon::warning] Unknown argument '--unknown' will be ignored.
known =
```
-- `ap::unknown_policy::ignore` - ignores unknown argument flags and continues parsing the remaining arguments:
+- `argon::unknown_policy::ignore` - ignores unknown argument flags and continues parsing the remaining arguments:
```txt
./unknown-policy-test --known --unknown
known =
```
-- `ap::unknown_policy::as_values` - treats unknown argument flags as values:
+- `argon::unknown_policy::as_values` - treats unknown argument flags as values:
```txt
> ./unknown-policy-test --known --unknown
@@ -1247,8 +1247,8 @@ The available policies are:
> Consider a similar example as above with only the argument parsing function changed:
> ```cpp
> const auto unknown_args = parser.try_parse_known_args(argc, argv);
-> std::cout << "known = " << ap::util::join(parser.values("known")) << std::endl
-> << "unknown = " << ap::util::join(unknown_args) << std::endl;
+> std::cout << "known = " << argon::util::join(parser.values("known")) << std::endl
+> << "unknown = " << argon::util::join(unknown_args) << std::endl;
> ```
> This would produce the following output regardless of the specified unknown arguments policy.
> ```shell
@@ -1281,7 +1281,7 @@ parser.try_parse_args(argc, argv);
std::cout << "Verbosity level: " << parser.count("verbose")
<< "\nOption used: " << std::boolalpha << parser.value("use-option")
- << "\nNumbers: " << ap::util::join(parser.values("numbers"), ", ")
+ << "\nNumbers: " << argon::util::join(parser.values("numbers"), ", ")
<< std::endl;
/*
@@ -1308,29 +1308,29 @@ Consider a simple example:
```cpp
parser.add_optional_argument("recognized", "r")
- .nargs(ap::nargs::up_to(2))
+ .nargs(argon::nargs::up_to(2))
.help("A recognized optional argument");
parser.parse_args(argc, argv);
-std::cout << "recognized = " << ap::util::join(parser.values("recognized")) << std::endl;
+std::cout << "recognized = " << argon::util::join(parser.values("recognized")) << std::endl;
/* Example executions:
> ./program --recognized value1 value2
recognized = value1, value2
> ./program --recognized value1 value2 value3
-terminate called after throwing an instance of 'ap::parsing_failure'
+terminate called after throwing an instance of 'argon::parsing_failure'
what(): Failed to deduce the argument for values [value3]
Aborted (core dumped)
> ./program value0 --recognized value1 value2
-terminate called after throwing an instance of 'ap::parsing_failure'
+terminate called after throwing an instance of 'argon::parsing_failure'
what(): Failed to deduce the argument for values [value0]
Aborted (core dumped)
> ./program --recognized value1 value2 --unrecognized value
-terminate called after throwing an instance of 'ap::parsing_failure'
+terminate called after throwing an instance of 'argon::parsing_failure'
what(): Unknown argument [--unrecognized].
Aborted (core dumped)
>
@@ -1340,13 +1340,13 @@ Here the parser throws exceptions for arguments it doesn't recognize. Now consid
```cpp
parser.add_optional_argument("recognized", "r")
- .nargs(ap::nargs::up_to(2))
+ .nargs(argon::nargs::up_to(2))
.help("A recognized optional argument");
const auto unknown_args = parser.parse_known_args(argc, argv);
-std::cout << "recognized = " << ap::util::join(parser.values("recognized")) << std::endl
- << "unknown = " << ap::util::join(unknown_args) << std::endl;
+std::cout << "recognized = " << argon::util::join(parser.values("recognized")) << std::endl
+ << "unknown = " << argon::util::join(unknown_args) << std::endl;
/* Example execution:
> ./program value0 --recognized value1 value2 value3 --unrecognized value
@@ -1364,14 +1364,14 @@ Now all the values, that caused an exception for the `parse_args` example, are c
> parser.add_positional_argument("positional")
> .help("A positional argument");
> parser.add_optional_argument("recognized", "r")
-> .nargs(ap::nargs::any())
+> .nargs(argon::nargs::any())
> .help("A recognized optional argument");
>
> const auto unknown_args = parser.parse_known_args(argc, argv);
>
> std::cout << "positional = " << parser.value("positional") << std::endl
-> << "recognized = " << ap::util::join(parser.values("recognized")) << std::endl
-> << "unknown = " << ap::util::join(unknown_args) << std::endl;
+> << "recognized = " << argon::util::join(parser.values("recognized")) << std::endl
+> << "unknown = " << argon::util::join(unknown_args) << std::endl;
>
> /* Example execution:
> > ./program --recognized value1 value2 value3 --unrecognized value4 value5 --recognized value6
@@ -1446,20 +1446,20 @@ Subparsers allow you to build **hierarchical command-line interfaces**, where a
auto& subparser = parser.add_subparser("subprogram");
```
-Each subparser is a separate instance of `ap::argument_parser` and therefore it can have its own parameters, including a description, arguments, argument groups, subparsers, etc.
+Each subparser is a separate instance of `argon::argument_parser` and therefore it can have its own parameters, including a description, arguments, argument groups, subparsers, etc.
For example:
```cpp
// top-level parser
-ap::argument_parser git("ap-git");
+argon::argument_parser git("ap-git");
git.program_version({.major = 2u, .minor = 43u, .patch = 0u})
- .program_description("A version control system built with CPP-AP")
- .default_arguments(ap::default_argument::o_help, ap::default_argument::o_version);
+ .program_description("A version control system built with CPP-ARGON")
+ .default_arguments(argon::default_argument::o_help, argon::default_argument::o_version);
// subcommand: status
auto& status = git.add_subparser("status");
-status.default_arguments(ap::default_argument::o_help)
+status.default_arguments(argon::default_argument::o_help)
.program_description("Show the working tree status");
status.add_flag("short", "s")
.help("Give the output in the short-format");
@@ -1494,7 +1494,7 @@ All defined subparsers will be included in the parent parser's help message:
> ap-git --help
Program: ap-git (v2.43.0)
- A version control system built with CPP-AP
+ A version control system built with CPP-ARGON
Commands:
@@ -1521,7 +1521,7 @@ When parsing command-line arguments, the parent parser will attempt to match the
For example:
```cpp
-ap::argument_parser git("ap-git");
+argon::argument_parser git("ap-git");
auto& submodule = git.add_subparser("submodule");
auto& submodule_init = submodule.add_subparser("init");
```
@@ -1540,7 +1540,7 @@ Each parser tracks its state during parsing. The methods described below let you
This is distinct from `invoked()`: a parser can be *invoked* but not *finalized* if one of its subparsers handled the arguments instead.
-- `resolved_parser() -> ap::argument_parser&` : Returns a reference to the *deepest invoked parser*.
+- `resolved_parser() -> argon::argument_parser&` : Returns a reference to the *deepest invoked parser*.
If no subparser was invoked, this simply returns the current parser.
@@ -1550,7 +1550,7 @@ Each parser tracks its state during parsing. The methods described below let you
```cpp
// define the parser hierarchy
-ap::argument_parser git("ap-git");
+argon::argument_parser git("ap-git");
auto& submodule = git.add_subparser("submodule");
auto& submodule_init = submodule.add_subparser("init");
@@ -1589,26 +1589,26 @@ Resolved parser : init (ap-git submodule init)
## Examples
-The library usage examples and demo projects are included in the `cpp-ap-demo` submodule.
+The library usage examples and demo projects are included in the `cpp-argon-demo` submodule.
To fetch the submodule content after cloning the main repository, run:
```bash
git submodule update --init --recursive
```
-For more detailed information about the demo projects, see the [cpp-ap-demo](https://github.com/SpectraL519/cpp-ap-demo) README.
+For more detailed information about the demo projects, see the [cpp-argon-demo](https://github.com/SpectraL519/cpp-argon-demo) README.
-The following table lists the projects provided in the `cpp-ap-demo` submodule:
+The following table lists the projects provided in the `cpp-argon-demo` submodule:
| Project | Description |
| :- | :- |
-| [Power Calculator](https://github.com/SpectraL519/cpp-ap-demo/tree/master/power_calculator/) | Calculates the value of a $b^e$ expression for the given base and exponents.
**Demonstrates:** The basic usage of positional and optional arguments. |
-| [File Merger](https://github.com/SpectraL519/cpp-ap-demo/tree/master/file_merger/) | Merges multiple text files into a single output file.
**Demonstrates:** The usage of default arguments. |
-| [Numbers Converter](https://github.com/SpectraL519/cpp-ap-demo/tree/master/numbers_converter/) | Converts numbers between different bases.
**Demonstrates:** The usage of argument parameters such as *nargs*, *choices*, and *default values*. |
-| [Verbosity](https://github.com/SpectraL519/cpp-ap-demo/tree/master/verbosity/) | Prints messages with varying levels of verbosity.
**Demonstrates:** The usage of `none_type` arguments and compound argument flags. |
-| [Logging Mode](https://github.com/SpectraL519/cpp-ap-demo/tree/master/logging_mode/) | Logs a message depending on the selected logging mode (`quiet`, `normal`, `verbose`).
**Demonstrates:** The usage of custom argument value types (like enums). |
-| [Message Logger](https://github.com/SpectraL519/cpp-ap-demo/arg_parsertree/master/message_logger/) | Outputs a message to a file, console, or not at all.
**Demonstrates:** The usage of argument groups. |
-| [AP-GIT](https://github.com/SpectraL519/cpp-ap-demo/tree/master/ap_git/) | A minimal Git CLI clone with subcommands (`init`, `add`, `commit`, `status`, `push`).
**Demonstrates:** The usage of subparsers for multi-command CLIs and complex argument configurations. |
+| [Power Calculator](https://github.com/SpectraL519/cpp-argon-demo/tree/master/power_calculator/) | Calculates the value of a $b^e$ expression for the given base and exponents.
**Demonstrates:** The basic usage of positional and optional arguments. |
+| [File Merger](https://github.com/SpectraL519/cpp-argon-demo/tree/master/file_merger/) | Merges multiple text files into a single output file.
**Demonstrates:** The usage of default arguments. |
+| [Numbers Converter](https://github.com/SpectraL519/cpp-argon-demo/tree/master/numbers_converter/) | Converts numbers between different bases.
**Demonstrates:** The usage of argument parameters such as *nargs*, *choices*, and *default values*. |
+| [Verbosity](https://github.com/SpectraL519/cpp-argon-demo/tree/master/verbosity/) | Prints messages with varying levels of verbosity.
**Demonstrates:** The usage of `none_type` arguments and compound argument flags. |
+| [Logging Mode](https://github.com/SpectraL519/cpp-argon-demo/tree/master/logging_mode/) | Logs a message depending on the selected logging mode (`quiet`, `normal`, `verbose`).
**Demonstrates:** The usage of custom argument value types (like enums). |
+| [Message Logger](https://github.com/SpectraL519/cpp-argon-demo/arg_parsertree/master/message_logger/) | Outputs a message to a file, console, or not at all.
**Demonstrates:** The usage of argument groups. |
+| [AP-GIT](https://github.com/SpectraL519/cpp-argon-demo/tree/master/ap_git/) | A minimal Git CLI clone with subcommands (`init`, `add`, `commit`, `status`, `push`).
**Demonstrates:** The usage of subparsers for multi-command CLIs and complex argument configurations. |
@@ -1616,4 +1616,4 @@ The following table lists the projects provided in the `cpp-ap-demo` submodule:
## Common Utility
-The CPP-AP library provides additional utilities, described on the [Utility topic page](https://spectral519.github.io/cpp-ap/latest/group__util.html).
+The CPP-ARGON library provides additional utilities, described on the [Utility topic page](https://spectral519.github.io/cpp-argon/latest/group__util.html).
diff --git a/doxygen-ext-stylesheet.css b/doxygen-ext-stylesheet.css
index 140db04d..cbcb0c85 100644
--- a/doxygen-ext-stylesheet.css
+++ b/doxygen-ext-stylesheet.css
@@ -1,4 +1,4 @@
-@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
+@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css");
.fa {
vertical-align: middle;
@@ -7,3 +7,36 @@
.fa:hover {
transform: scale(1.2);
}
+
+/* Reduce padding around the title area */
+#titlearea {
+ padding: 0.2em 0 !important;
+}
+#titlearea table {
+ margin: 0 !important;
+}
+
+/* Reduce projectrow cell padding */
+#projectrow td {
+ padding: 0.2em 0.6em !important;
+ vertical-align: middle !important;
+}
+
+/* Constrain logo height */
+#projectlogo img {
+ max-height: 90px;
+ width: auto;
+ display: block;
+}
+
+/* Tighten project name & brief spacing */
+#projectname {
+ font-size: 1.6em;
+ line-height: 1.1em;
+ margin: 0 !important;
+}
+#projectbrief {
+ font-size: 0.9em;
+ line-height: 1.1em;
+ margin: 0 !important;
+}
diff --git a/include/ap/action/predefined.hpp b/include/argon/action/predefined.hpp
similarity index 80%
rename from include/ap/action/predefined.hpp
rename to include/argon/action/predefined.hpp
index 31c1e283..95cc0878 100644
--- a/include/ap/action/predefined.hpp
+++ b/include/argon/action/predefined.hpp
@@ -1,18 +1,18 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/action/predefined.hpp
+/// @file argon/action/predefined.hpp
#pragma once
-#include "ap/action/util/helpers.hpp"
-#include "ap/exceptions.hpp"
+#include "argon/action/util/helpers.hpp"
+#include "argon/exceptions.hpp"
#include
#include
-namespace ap {
+namespace argon {
class argument_parser;
std::ostream& operator<<(std::ostream& os, const argument_parser&) noexcept;
@@ -25,7 +25,7 @@ namespace action {
* @param exit_code The exit code with which `std::exit` will be called (if not `std::nullopt`).
* @param os The output stream to which the help message will be printed.
*/
-inline typename ap::action_type::on_flag::type print_help(
+inline typename argon::action_type::on_flag::type print_help(
const argument_parser& parser,
const std::optional exit_code = std::nullopt,
std::ostream& os = std::cout
@@ -38,7 +38,7 @@ inline typename ap::action_type::on_flag::type print_help(
}
/// @brief Returns an *observe* action which checks whether lower_bound file with the given name exists.
-inline util::callable_type check_file_exists() noexcept {
+inline util::callable_type check_file_exists() noexcept {
return [](const std::string& file_path) {
if (not std::filesystem::exists(file_path))
throw std::filesystem::filesystem_error(
@@ -54,8 +54,8 @@ inline util::callable_type check_file_exi
* @tparam T The *arithmetic* value type.
* @param lower_bound The exclusive lower bound to validate against.
*/
-template
-util::callable_type gt(const T lower_bound) noexcept {
+template
+util::callable_type gt(const T lower_bound) noexcept {
return [lower_bound](const T& value) {
if (not (value > lower_bound))
throw std::out_of_range(
@@ -69,8 +69,8 @@ util::callable_type gt(const T lower_bound) noexcep
* @tparam T The *arithmetic* value type.
* @param lower_bound The inclusive lower bound to validate against.
*/
-template
-util::callable_type geq(const T lower_bound) noexcept {
+template
+util::callable_type geq(const T lower_bound) noexcept {
return [lower_bound](const T& value) {
if (! (value >= lower_bound))
throw std::out_of_range(
@@ -84,8 +84,8 @@ util::callable_type geq(const T lower_bound) noexce
* @tparam T The *arithmetic* value type.
* @param lower_bound The exclusive upper bound to validate against.
*/
-template
-util::callable_type lt(const T upper_bound) noexcept {
+template
+util::callable_type lt(const T upper_bound) noexcept {
return [upper_bound](const T& value) {
if (! (value < upper_bound))
throw std::out_of_range(
@@ -99,8 +99,8 @@ util::callable_type lt(const T upper_bound) noexcep
* @tparam T The *arithmetic* value type.
* @param lower_bound The inclusive upper bound to validate against.
*/
-template
-util::callable_type leq(const T upper_bound) noexcept {
+template
+util::callable_type leq(const T upper_bound) noexcept {
return [upper_bound](const T& value) {
if (! (value <= upper_bound))
throw std::out_of_range(
@@ -120,8 +120,8 @@ util::callable_type leq(const T upper_bound) noexce
* @param lower_bound The lower bound of the interval.
* @param upper_bound The upper bound of the interval.
*/
-template
-util::callable_type within(
+template
+util::callable_type within(
const T lower_bound, const T upper_bound
) noexcept {
return [lower_bound, upper_bound](const T& value) {
@@ -145,4 +145,4 @@ util::callable_type within(
}
} // namespace action
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/action/types.hpp b/include/argon/action/types.hpp
similarity index 75%
rename from include/ap/action/types.hpp
rename to include/argon/action/types.hpp
index 05ea9820..f243f6ec 100644
--- a/include/ap/action/types.hpp
+++ b/include/argon/action/types.hpp
@@ -1,19 +1,19 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/action/types.hpp
+ * @file argon/action/types.hpp
* @brief Defies the action specifier types.
*/
#pragma once
-#include "ap/util/concepts.hpp"
+#include "argon/util/concepts.hpp"
#include
-namespace ap::action_type {
+namespace argon::action_type {
/**
* @brief An observing *value* action specifier.
@@ -22,7 +22,7 @@ namespace ap::action_type {
* performs some logic on it without modifying it.
*/
struct observe {
- template
+ template
using type = std::function;
};
@@ -33,7 +33,7 @@ struct observe {
* returns a new value with which the argument will be initialized.
*/
struct transform {
- template
+ template
using type = std::function;
};
@@ -44,7 +44,7 @@ struct transform {
* already initialized argument.
*/
struct modify {
- template
+ template
using type = std::function;
};
@@ -60,4 +60,4 @@ struct on_flag {
using type = std::function;
};
-} // namespace ap::action_type
+} // namespace argon::action_type
diff --git a/include/ap/action/util/concepts.hpp b/include/argon/action/util/concepts.hpp
similarity index 66%
rename from include/ap/action/util/concepts.hpp
rename to include/argon/action/util/concepts.hpp
index d6547ffc..963289bb 100644
--- a/include/ap/action/util/concepts.hpp
+++ b/include/argon/action/util/concepts.hpp
@@ -1,20 +1,20 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/action/util/concepts.hpp
+ * @file argon/action/util/concepts.hpp
* @brief Defines action-related concepts.
*/
#pragma once
-#include "ap/action/types.hpp"
+#include "argon/action/types.hpp"
#include
#include
-namespace ap::action::util {
+namespace argon::action::util {
/**
* @brief The concept is satisfied when `AS` is a valid *value* action action specifier.
@@ -23,7 +23,7 @@ namespace ap::action::util {
*/
template
concept c_value_action_specifier =
- ap::util::c_one_of;
+ argon::util::c_one_of;
/**
* @brief The concept is satisfied when `AS` is a valid *on-flag* action action specifier.
@@ -31,7 +31,7 @@ concept c_value_action_specifier =
* @ingroup util
*/
template
-concept c_flag_action_specifier = ap::util::c_one_of;
+concept c_flag_action_specifier = argon::util::c_one_of;
/**
* @brief The concept is satisfied when `AS` is a valid action action specifier.
@@ -41,4 +41,4 @@ concept c_flag_action_specifier = ap::util::c_one_of;
template
concept c_action_specifier = c_value_action_specifier or std::same_as;
-} // namespace ap::action::util
+} // namespace argon::action::util
diff --git a/include/ap/action/util/helpers.hpp b/include/argon/action/util/helpers.hpp
similarity index 79%
rename from include/ap/action/util/helpers.hpp
rename to include/argon/action/util/helpers.hpp
index be2abb52..48dea4dc 100644
--- a/include/ap/action/util/helpers.hpp
+++ b/include/argon/action/util/helpers.hpp
@@ -1,28 +1,28 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/action/util/helpers.hpp
+ * @file argon/action/util/helpers.hpp
* @brief Defines general action-related helper utility.
*/
#pragma once
-#include "ap/action/util/concepts.hpp"
+#include "argon/action/util/concepts.hpp"
#include
#include
-namespace ap::action::util {
+namespace argon::action::util {
/// @brief Template argument action callable type alias.
/// @ingroup util
-template
+template
using callable_type = typename AS::template type;
/// @brief Template argument action callabla variant type alias.
-template
+template
using value_action_variant_type = std::variant<
callable_type,
callable_type,
@@ -33,7 +33,7 @@ using value_action_variant_type = std::variant<
* @tparam T The argument's value type
* @ingroup util
*/
-template
+template
struct apply_visitor {
using value_type = T;
@@ -64,4 +64,4 @@ struct apply_visitor {
value_type& value; ///< A reference to the argument's value for which the action will be applied.
};
-} // namespace ap::action::util
+} // namespace argon::action::util
diff --git a/include/ap/argument.hpp b/include/argon/argument.hpp
similarity index 94%
rename from include/ap/argument.hpp
rename to include/argon/argument.hpp
index 2ea49910..55dd2711 100644
--- a/include/ap/argument.hpp
+++ b/include/argon/argument.hpp
@@ -1,31 +1,31 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/argument.hpp
+/// @file argon/argument.hpp
#pragma once
-#include "ap/action/predefined.hpp"
-#include "ap/action/util/helpers.hpp"
-#include "ap/detail/argument_base.hpp"
-#include "ap/detail/help_builder.hpp"
-#include "ap/nargs/range.hpp"
-#include "ap/types.hpp"
-#include "ap/util/concepts.hpp"
-#include "ap/util/ranges.hpp"
+#include "argon/action/predefined.hpp"
+#include "argon/action/util/helpers.hpp"
+#include "argon/detail/argument_base.hpp"
+#include "argon/detail/help_builder.hpp"
+#include "argon/nargs/range.hpp"
+#include "argon/types.hpp"
+#include "argon/util/concepts.hpp"
+#include "argon/util/ranges.hpp"
#ifdef AP_TESTING
-namespace ap_testing {
+namespace argon_testing {
struct argument_test_fixture;
-} // namespace ap_testing
+} // namespace argon_testing
#endif
-namespace ap {
+namespace argon {
-/// @brief A discriminator type used to specify the type of an argument within the @ref ap::argument class.
+/// @brief A discriminator type used to specify the type of an argument within the @ref argon::argument class.
enum class argument_type : bool { positional, optional };
/**
@@ -38,12 +38,12 @@ enum class argument_type : bool { positional, optional };
* @note - `add_positional_argument`
* @note - `add_optional_argument`
* @note - `add_flag`
- * @note methods of @ref ap::argument_parser.
+ * @note methods of @ref argon::argument_parser.
* @attention Some member functions are conditionally enabled/disabled depending on the argument type and value type.
*
* Example usage:
* @code{.cpp}
- * ap::argument_parser parser;
+ * argon::argument_parser parser;
* parser.add_positional_argument("input", "i")
* .help("An input file path");
* parser.add_optional_argument("output", "o")
@@ -51,7 +51,7 @@ enum class argument_type : bool { positional, optional };
* .help("An output file path");
* @endcode
*
- * @tparam ArgT The argument type, either @ref ap::argument_type::positional or @ref ap::argument_type::optional.
+ * @tparam ArgT The argument type, either @ref argon::argument_type::positional or @ref argon::argument_type::optional.
* @tparam T The value type accepted by the argument (defaults to std::string).
*/
template
@@ -98,7 +98,7 @@ class argument : public detail::argument_base {
}
/// @return Reference the name of the positional argument.
- [[nodiscard]] const ap::detail::argument_name& name() const noexcept override {
+ [[nodiscard]] const argon::detail::argument_name& name() const noexcept override {
return this->_name;
}
@@ -158,7 +158,7 @@ class argument : public detail::argument_base {
* @brief Set the `required` attribute of the argument
* @param value The attribute value (default: `true`).
* @return Reference to the argument instance.
- * @throws ap::invalid_configuration if the argument is configured to suppress argument/group checks.
+ * @throws argon::invalid_configuration if the argument is configured to suppress argument/group checks.
*/
argument& required(const bool value = true) {
if (value and (this->_suppress_arg_checks or this->_suppress_group_checks))
@@ -174,7 +174,7 @@ class argument : public detail::argument_base {
* @brief Enable/disable suppressing argument checks for other arguments.
* @param value The attribute value (default: `true`).
* @return Reference to the argument instance.
- * @throws ap::invalid_configuration if the argument is configured to be required.
+ * @throws argon::invalid_configuration if the argument is configured to be required.
*/
argument& suppress_arg_checks(const bool value = true) {
if (value and this->_required)
@@ -190,7 +190,7 @@ class argument : public detail::argument_base {
* @brief Enable/disable suppressing argument group checks.
* @param value The attribute value (default: `true`).
* @return Reference to the argument instance.
- * @throws ap::invalid_configuration if the argument is configured to be required.
+ * @throws argon::invalid_configuration if the argument is configured to be required.
*/
argument& suppress_group_checks(const bool value = true) {
if (value and this->_required)
@@ -255,7 +255,7 @@ class argument : public detail::argument_base {
/**
* @brief Set the *value* action for the argument.
- * @tparam AS The action specifier type (see @ref ap/action/type.hpp).
+ * @tparam AS The action specifier type (see @ref argon/action/type.hpp).
* @tparam F The type of the action function.
* @param action The action callable.
* @return Reference to the argument instance.
@@ -274,7 +274,7 @@ class argument : public detail::argument_base {
/**
* @brief Set the *on-flag* action for the argument.
- * @tparam AS The action specifier type (see @ref ap/action/types.hpp).
+ * @tparam AS The action specifier type (see @ref argon/action/types.hpp).
* @tparam F The type of the action function.
* @param action The action callable.
* @return Reference to the argument instance.
@@ -419,7 +419,7 @@ class argument : public detail::argument_base {
}
#ifdef AP_TESTING
- friend struct ::ap_testing::argument_test_fixture;
+ friend struct ::argon_testing::argument_test_fixture;
#endif
private:
@@ -522,7 +522,7 @@ class argument : public detail::argument_base {
* @brief Set the value for the optional argument.
* @param str_value The string value to use.
* @return `true` if the argument accepts further values, `false` otherwise.
- * @throws ap::parsing_failure
+ * @throws argon::parsing_failure
*/
bool set_value(const std::string& str_value) override {
return this->_set_value_impl(str_value);
@@ -659,18 +659,17 @@ class argument : public detail::argument_base {
}
/// @return `true` if the given value is a valid choice for the argument, `false` otherwise.
- /// @todo Use std::ranges::contains after the switch to C++23
[[nodiscard]] bool _is_valid_choice(const value_type& value) const noexcept
requires(not util::c_is_none)
{
return this->_choices.empty()
- or std::ranges::find(this->_choices, value) != this->_choices.end();
+ or std::ranges::find(this->_choices, value) != std::ranges::end(this->_choices);
}
/**
* @brief The implementation of the `set_value` method for none-type arguments.
* @param str_value The string value to set.
- * @throws ap::parsing_failure
+ * @throws argon::parsing_failure
* @attention Always throws! (`set_value` should never be called for a none-type argument).
*/
bool _set_value_impl(const std::string& str_value)
@@ -687,7 +686,7 @@ class argument : public detail::argument_base {
* @brief The implementation of the `set_value` method for non-none-type arguments.
* @return `true` if the argument accepts further values, `false` otherwise.
* @param str_value The string value to set.
- * @throws ap::parsing_failure if:
+ * @throws argon::parsing_failure if:
* @throws - the argument does not accept further values (nargs limit exceeded).
* @throws - the value cannot be parsed to the argument's `value_type`.
* @throws - the value is not a valid choice for the argument (if choices are defined).
@@ -724,7 +723,7 @@ class argument : public detail::argument_base {
}
// attributes
- const ap::detail::argument_name _name; ///< The argument's name.
+ const argon::detail::argument_name _name; ///< The argument's name.
std::optional _help_msg; ///< The argument's help message.
nargs::range _nargs_range; ///< The argument's nargs range attribute value.
[[no_unique_address]] value_arg_specific_type>
@@ -762,7 +761,7 @@ class argument : public detail::argument_base {
/**
* @brief Positional argument alias.
* @tparam T The value type accepted by the argument (defaults to std::string).
- * @see ap::argument
+ * @see argon::argument
*/
template
using positional_argument = argument;
@@ -770,9 +769,9 @@ using positional_argument = argument;
/**
* @brief Optional argument alias.
* @tparam T The value type accepted by the argument (defaults to std::string).
- * @see ap::argument
+ * @see argon::argument
*/
template
using optional_argument = argument;
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/argument_group.hpp b/include/argon/argument_group.hpp
similarity index 90%
rename from include/ap/argument_group.hpp
rename to include/argon/argument_group.hpp
index 580a794e..fe1d1b09 100644
--- a/include/ap/argument_group.hpp
+++ b/include/argon/argument_group.hpp
@@ -1,16 +1,16 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/argument_group.hpp
+/// @file argon/argument_group.hpp
#pragma once
-#include "ap/detail/argument_base.hpp"
+#include "argon/detail/argument_base.hpp"
#include
-namespace ap {
+namespace argon {
/**
* @brief Represents a group of arguments.
@@ -21,19 +21,19 @@ namespace ap {
* - required: **at least one** argument from the group must be used in the command-line
* - mutually exclusive: **at most one** argument from the group can be used in the command-line
*
- * @note - This class is not intended to be constructed directly, but rather through the `add_group` method of @ref ap::argument_parser.
+ * @note - This class is not intended to be constructed directly, but rather through the `add_group` method of @ref argon::argument_parser.
* @note - User defined groups may contain only optional arguments (and flags).
*
* Example usage:
* @code{.cpp}
- * ap::argument_parser parser("myprog");
+ * argon::argument_parser parser("myprog");
* auto& out_opts = parser.add_group("Output Options").mutually_exclusive();
*
* group.add_optional_argument(out_opts, "output", "o")
* .nargs(1)
* .help("Print output to the given file");
*
- * group.add_optional_argument(out_opts, "print", "p")
+ * group.add_optional_argument(out_opts, "print", "p")
* .help("Print output to the console");
* @endcode
* Here `out_opts` is a mutually exclusive group, so using both arguments at the same time would cause an error.
@@ -120,4 +120,4 @@ class argument_group {
false; ///< The mutually exclusive attribute value (default: false).
};
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/argument_parser.hpp b/include/argon/argument_parser.hpp
similarity index 95%
rename from include/ap/argument_parser.hpp
rename to include/argon/argument_parser.hpp
index 835cbbca..6c1c90ff 100644
--- a/include/ap/argument_parser.hpp
+++ b/include/argon/argument_parser.hpp
@@ -1,18 +1,19 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/argument_parser.hpp
+ * @file argon/argument_parser.hpp
* @brief Main library header file. Defines the `argument_parser` class.
*/
#pragma once
-#include "ap/argument.hpp"
-#include "ap/argument_group.hpp"
-#include "ap/detail/argument_token.hpp"
-#include "ap/types.hpp"
+#include "argon/argument.hpp"
+#include "argon/argument_group.hpp"
+#include "argon/detail/argument_token.hpp"
+#include "argon/types.hpp"
+#include "argon/util/ranges.hpp"
#include
#include
@@ -22,13 +23,13 @@
#ifdef AP_TESTING
-namespace ap_testing {
+namespace argon_testing {
struct argument_parser_test_fixture;
-} // namespace ap_testing
+} // namespace argon_testing
#endif
-namespace ap {
+namespace argon {
class argument_parser;
@@ -39,7 +40,7 @@ enum class default_argument : std::uint8_t {
* Equivalent to:
* @code{.cpp}
* parser.add_positional_argument("input")
- * .action(ap::action::check_file_exists())
+ * .action(argon::action::check_file_exists())
* .help("Input file path");
* @endcode
*/
@@ -59,8 +60,8 @@ enum class default_argument : std::uint8_t {
* @brief An optional argument representing the program's help flag.
* Equivalent to:
* @code{.cpp}
- * parser.add_optional_argument("help")
- * .action(ap::action::print_help(parser, EXIT_SUCCESS))
+ * parser.add_optional_argument("help")
+ * .action(argon::action::print_help(parser, EXIT_SUCCESS))
* .help("Display the help message");
* @endcode
*/
@@ -86,7 +87,7 @@ enum class default_argument : std::uint8_t {
* @code{.cpp}
* parser.add_positional_argument("input", "i")
* .nargs(1ull)
- * .action(ap::action::check_file_exists())
+ * .action(argon::action::check_file_exists())
* .help("Input file path");
* @endcode
*/
@@ -108,8 +109,8 @@ enum class default_argument : std::uint8_t {
* Equivalent to:
* @code{.cpp}
* parser.add_positional_argument("input", "i")
- * .nargs(ap::nargs::at_least(1ull))
- * .action(ap::action::check_file_exists())
+ * .nargs(argon::nargs::at_least(1ull))
+ * .action(argon::action::check_file_exists())
* .help("Input file path");
* @endcode
*/
@@ -120,7 +121,7 @@ enum class default_argument : std::uint8_t {
* Equivalent to:
* @code{.cpp}
* parser.add_positional_argument("output", "o")
- * .nargs(ap::nargs::at_least(1ull))
+ * .nargs(argon::nargs::at_least(1ull))
* .help("Output file path");
* @endcode
*/
@@ -149,20 +150,20 @@ void add_default_argument(const default_argument, argument_parser&) noexcept;
*
* Example usage:
* @code{.cpp}
- * #include
+ * #include
*
* int main(int argc, char* argv[]) {
* // Create the argument parser instance
- * ap::argument_parser parser("fcopy");
+ * argon::argument_parser parser("fcopy");
* parser.program_version({ .major = 1, .minor = 0, .patch = 0 })
* .program_description("A simple file copy utility.")
* .default_arguments(
- * ap::default_argument::o_help,
- * ap::default_argument::o_input,
- * ap::default_argument::o_output
+ * argon::default_argument::o_help,
+ * argon::default_argument::o_input,
+ * argon::default_argument::o_output
* )
* .verbose()
- * .unknown_arguments_policy(ap::unknown_policy::ignore)
+ * .unknown_arguments_policy(argon::unknown_policy::ignore)
* .try_parse_args(argc, argv);
*
* // Access parsed argument values
@@ -237,7 +238,7 @@ class argument_parser {
* @brief Set the unknown argument flags handling policy.
* @param policy The unknown arguments policy value.
* @return Reference to the argument parser.
- * @note The default unknown arguments policy value is `ap::unknown_policy::fail`.
+ * @note The default unknown arguments policy value is `argon::unknown_policy::fail`.
*/
argument_parser& unknown_arguments_policy(const unknown_policy policy) noexcept {
this->_unknown_policy = policy;
@@ -248,7 +249,7 @@ class argument_parser {
* @brief Add default arguments to the argument parser.
* @tparam AR Type of the positional argument discriminator range.
* @param arg_discriminators A range of default positional argument discriminators.
- * @note `arg_discriminators` must be a `std::ranges::range` with the `ap::default_argument` value type.
+ * @note `arg_discriminators` must be a `std::ranges::range` with the `argon::default_argument` value type.
* @return Reference to the argument parser.
*/
template AR>
@@ -286,7 +287,7 @@ class argument_parser {
* @tparam T Type of the argument value.
* @param name The name of the argument.
* @return Reference to the added positional argument.
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
template
positional_argument& add_positional_argument(const std::string_view name) {
@@ -298,7 +299,7 @@ class argument_parser {
* @tparam T Type of the argument value.
* @param primary_name The name of the argument.
* @return Reference to the added positional argument.
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
template
positional_argument& add_positional_argument(
@@ -323,7 +324,7 @@ class argument_parser {
* @param name The name of the argument.
* @param name_discr The discriminator value specifying whether the given name should be treated as primary or secondary.
* @return Reference to the added optional argument.
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
template
optional_argument& add_optional_argument(
@@ -339,7 +340,7 @@ class argument_parser {
* @param primary_name The primary name of the argument.
* @param secondary_name The secondary name of the argument.
* @return Reference to the added optional argument.
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
template
optional_argument& add_optional_argument(
@@ -357,7 +358,7 @@ class argument_parser {
* @param name The name of the argument.
* @param name_discr The discriminator value specifying whether the given name should be treated as primary or secondary.
* @return Reference to the added optional argument.
- * @throws std::logic_error, ap::invalid_configuration
+ * @throws std::logic_error, argon::invalid_configuration
*/
template
optional_argument& add_optional_argument(
@@ -392,7 +393,7 @@ class argument_parser {
* @param primary_name The primary name of the argument.
* @param secondary_name The secondary name of the argument.
* @return Reference to the added optional argument.
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
template
optional_argument& add_optional_argument(
@@ -537,7 +538,7 @@ class argument_parser {
*
* @param argc Number of command-line arguments.
* @param argv Array of command-line argument values.
- * @throws ap::invalid_configuration, ap::parsing_failure
+ * @throws argon::invalid_configuration, argon::parsing_failure
* @attention The first argument (the program name) is ignored.
*/
void parse_args(int argc, char* argv[]) {
@@ -549,7 +550,7 @@ class argument_parser {
* @tparam AR The argument range type.
* @param argv_rng A range of command-line argument values.
* @note `argv_rng` must be a `std::ranges::forward_range` with a value type convertible to `std::string`.
- * @throws ap::invalid_configuration, ap::parsing_failure
+ * @throws argon::invalid_configuration, argon::parsing_failure
* @attention This overload of the `parse_args` function assumes that the program name argument has already been discarded.
*/
template AR>
@@ -596,8 +597,8 @@ class argument_parser {
try {
this->parse_args(argv_rng);
}
- catch (const ap::argument_parser_exception& err) {
- std::cerr << "[ap::error] " << err.what() << std::endl
+ catch (const argon::argument_parser_exception& err) {
+ std::cerr << "[argon::error] " << err.what() << std::endl
<< this->resolved_parser() << std::endl;
std::exit(EXIT_FAILURE);
}
@@ -618,7 +619,7 @@ class argument_parser {
*
* @param argc Number of command-line arguments.
* @param argv Array of command-line argument values.
- * @throws ap::invalid_configuration, ap::parsing_failure
+ * @throws argon::invalid_configuration, argon::parsing_failure
* @attention The first argument (the program name) is ignored.
*/
std::vector parse_known_args(int argc, char* argv[]) {
@@ -636,7 +637,7 @@ class argument_parser {
* @tparam AR The argument range type.
* @param argv_rng A range of command-line argument values.
* @note `argv_rng` must be a `std::ranges::forward_range` with a value type convertible to `std::string`.
- * @throws ap::invalid_configuration, ap::parsing_failure
+ * @throws argon::invalid_configuration, argon::parsing_failure
* @attention This overload of the `parse_known_args` function assumes that the program name argument already been discarded.
*/
template AR>
@@ -681,8 +682,8 @@ class argument_parser {
try {
return this->parse_known_args(argv_rng);
}
- catch (const ap::argument_parser_exception& err) {
- std::cerr << "[ap::error] " << err.what() << std::endl
+ catch (const argon::argument_parser_exception& err) {
+ std::cerr << "[argon::error] " << err.what() << std::endl
<< this->resolved_parser() << std::endl;
std::exit(EXIT_FAILURE);
}
@@ -773,7 +774,7 @@ class argument_parser {
* @tparam T Type of the argument value.
* @param arg_name The name of the argument.
* @return The value of the argument.
- * @throws ap::lookup_failure, ap::type_error
+ * @throws argon::lookup_failure, argon::type_error
*/
template
[[nodiscard]] T value(std::string_view arg_name) const {
@@ -797,7 +798,7 @@ class argument_parser {
* @param arg_name The name of the argument.
* @param fallback_value The fallback value.
* @return The value of the argument.
- * @throws ap::lookup_failure, ap::type_error
+ * @throws argon::lookup_failure, argon::type_error
*/
template U>
[[nodiscard]] T value_or(std::string_view arg_name, U&& fallback_value) const {
@@ -824,7 +825,8 @@ class argument_parser {
* @tparam T Type of the argument values.
* @param arg_name The name of the argument.
* @return The values of the argument as a vector.
- * @throws ap::lookup_failure, ap::type_error
+ * @throws argon::lookup_failure, argon::type_error
+ * @todo Use std::ranges::to after transition to C++23 for range casting
*/
template
[[nodiscard]] std::vector values(std::string_view arg_name) const {
@@ -834,7 +836,6 @@ class argument_parser {
try {
std::vector values;
- // TODO: use std::ranges::to after transition to C++23
std::ranges::copy(
util::any_range_cast_view(arg->values()), std::back_inserter(values)
);
@@ -895,7 +896,7 @@ class argument_parser {
#ifdef AP_TESTING
/// @brief Friend struct for testing purposes.
- friend struct ::ap_testing::argument_parser_test_fixture;
+ friend struct ::argon_testing::argument_parser_test_fixture;
#endif
private:
@@ -950,7 +951,7 @@ class argument_parser {
/**
* @brief Verifies the pattern of an argument name and if it's invalid, an error is thrown
- * @throws ap::invalid_configuration
+ * @throws argon::invalid_configuration
*/
void _verify_arg_name_pattern(const std::string_view arg_name) const {
if (arg_name.empty())
@@ -1046,7 +1047,7 @@ class argument_parser {
* @param args_begin The begin iterator for the command-line argument value range.
* @param args_end The end iterator for the command-line argument value range.
* @param state The current parsing state.
- * @throws ap::invalid_configuration, ap::parsing_failure
+ * @throws argon::invalid_configuration, argon::parsing_failure
*/
template AIt>
void _parse_args_impl(AIt args_begin, const AIt args_end, parsing_state& state) {
@@ -1149,7 +1150,7 @@ class argument_parser {
case unknown_policy::fail:
throw parsing_failure::unknown_argument(tok.value);
case unknown_policy::warn:
- std::cerr << "[ap::warning] Unknown argument '" << tok.value << "' will be ignored."
+ std::cerr << "[argon::warning] Unknown argument '" << tok.value << "' will be ignored."
<< std::endl;
[[fallthrough]];
case unknown_policy::ignore:
@@ -1277,7 +1278,7 @@ class argument_parser {
* @brief Parse a single command-line argument token.
* @param tok The token to be parsed.
* @param state The current parsing state.
- * @throws ap::parsing_failure
+ * @throws argon::parsing_failure
*/
void _parse_token(const detail::argument_token& tok, parsing_state& state) {
if (state.curr_arg and state.curr_arg->is_greedy()) {
@@ -1295,7 +1296,7 @@ class argument_parser {
* @brief Parse a single command-line argument *flag* token.
* @param tok The token to be parsed.
* @param state The current parsing state.
- * @throws ap::parsing_failure
+ * @throws argon::parsing_failure
*/
void _parse_flag_token(const detail::argument_token& tok, parsing_state& state) {
if (not tok.is_valid_flag_token()) {
@@ -1322,7 +1323,7 @@ class argument_parser {
* @brief Parse a single command-line argument *value* token.
* @param tok The token to be parsed.
* @param state The current parsing state.
- * @throws ap::parsing_failure
+ * @throws argon::parsing_failure
*/
void _parse_value_token(const detail::argument_token& tok, parsing_state& state) {
if (not state.curr_arg) {
@@ -1357,7 +1358,7 @@ class argument_parser {
/**
* @brief Verifies the correctness of the parsed command-line arguments.
- * @throws ap::parsing_failure if the state of the parsed arguments is invalid.
+ * @throws argon::parsing_failure if the state of the parsed arguments is invalid.
*/
void _verify_final_state() const {
const auto [supress_group_checks, suppress_arg_checks] = this->_are_checks_suppressed();
@@ -1384,7 +1385,7 @@ class argument_parser {
}
};
- // TODO: use std::views::join after the transition to C++23
+ // TODO: use std::views::concat after the transition to C++26
std::ranges::for_each(this->_positional_args, check_arg);
std::ranges::for_each(this->_optional_args, check_arg);
return {suppress_group_checks, suppress_arg_checks};
@@ -1394,7 +1395,7 @@ class argument_parser {
* @brief Verifies whether the requirements of the given argument group are satisfied.
* @param group The argument group to verify.
* @param suppress_arg_checks A flag indicating whether argument checks are suppressed.
- * @throws ap::parsing_failure if the requirements are not satistied.
+ * @throws argon::parsing_failure if the requirements are not satistied.
*/
void _verify_group_requirements(
const argument_group& group,
@@ -1442,7 +1443,7 @@ class argument_parser {
* @brief Verifies whether the requirements of the given argument are satisfied.
* @param arg The argument to verify.
* @param suppress_arg_checks A flag indicating whether argument checks are suppressed.
- * @throws ap::parsing_failure if the requirements are not satistied.
+ * @throws argon::parsing_failure if the requirements are not satistied.
*/
void _verify_argument_requirements(const arg_ptr_t& arg, const bool suppress_arg_checks) const {
if (suppress_arg_checks)
@@ -1626,14 +1627,14 @@ inline void add_default_argument(
case default_argument::o_multi_input:
arg_parser.add_optional_argument("input", "i")
- .nargs(ap::nargs::at_least(1ull))
+ .nargs(argon::nargs::at_least(1ull))
.action(action::check_file_exists())
.help("Input files paths");
break;
case default_argument::o_multi_output:
arg_parser.add_optional_argument("output", "o")
- .nargs(ap::nargs::at_least(1ull))
+ .nargs(argon::nargs::at_least(1ull))
.help("Output files paths");
break;
}
@@ -1641,4 +1642,4 @@ inline void add_default_argument(
} // namespace detail
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/detail/argument_base.hpp b/include/argon/detail/argument_base.hpp
similarity index 90%
rename from include/ap/detail/argument_base.hpp
rename to include/argon/detail/argument_base.hpp
index 2f2f4502..80042abf 100644
--- a/include/ap/detail/argument_base.hpp
+++ b/include/argon/detail/argument_base.hpp
@@ -1,22 +1,22 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/detail/argument_base.hpp
+ * @file argon/detail/argument_base.hpp
* @brief Defines the base argument class and common utility.
*/
#pragma once
-#include "ap/detail/argument_name.hpp"
-#include "ap/detail/help_builder.hpp"
+#include "argon/detail/argument_name.hpp"
+#include "argon/detail/help_builder.hpp"
#include
#include
#include
-namespace ap {
+namespace argon {
class argument_parser;
@@ -54,7 +54,7 @@ class argument_base {
/// @return `true` if the argument is greedy, `false` otherwise.
virtual bool is_greedy() const noexcept = 0;
- friend class ::ap::argument_parser;
+ friend class ::argon::argument_parser;
protected:
/// @param verbose The verbosity mode value. If `true` all non-default parameters will be included in the output.
@@ -96,4 +96,4 @@ class argument_base {
};
} // namespace detail
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/detail/argument_name.hpp b/include/argon/detail/argument_name.hpp
similarity index 96%
rename from include/ap/detail/argument_name.hpp
rename to include/argon/detail/argument_name.hpp
index 6fadf31a..f3fa0ae2 100644
--- a/include/ap/detail/argument_name.hpp
+++ b/include/argon/detail/argument_name.hpp
@@ -1,8 +1,8 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/detail/argument_name.hpp
+/// @file argon/detail/argument_name.hpp
#pragma once
@@ -12,7 +12,7 @@
#include
#include
-namespace ap {
+namespace argon {
namespace detail {
@@ -150,4 +150,4 @@ enum class argument_name_discriminator : bool {
using enum detail::argument_name_discriminator;
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/detail/argument_token.hpp b/include/argon/detail/argument_token.hpp
similarity index 90%
rename from include/ap/detail/argument_token.hpp
rename to include/argon/detail/argument_token.hpp
index 4574da10..b25b1e46 100644
--- a/include/ap/detail/argument_token.hpp
+++ b/include/argon/detail/argument_token.hpp
@@ -1,19 +1,19 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/detail/argument_token.hpp
+/// @file argon/detail/argument_token.hpp
#pragma once
-#include "ap/detail/argument_base.hpp"
+#include "argon/detail/argument_base.hpp"
#include
#include
#include
#include
-namespace ap::detail {
+namespace argon::detail {
/// @brief Structure representing a single command-line argument token.
struct argument_token {
@@ -77,4 +77,4 @@ struct argument_token {
arg_ptr_vec_t args = {}; ///< The corresponding argument
};
-} // namespace ap::detail
+} // namespace argon::detail
diff --git a/include/ap/detail/help_builder.hpp b/include/argon/detail/help_builder.hpp
similarity index 94%
rename from include/ap/detail/help_builder.hpp
rename to include/argon/detail/help_builder.hpp
index ddb69752..fe5d9aef 100644
--- a/include/ap/detail/help_builder.hpp
+++ b/include/argon/detail/help_builder.hpp
@@ -1,17 +1,17 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/detail/help_builder.hpp
+ * @file argon/detail/help_builder.hpp
* @brief Defines structures for creating and formatting help messages.
*/
#pragma once
-#include "ap/detail/argument_name.hpp"
-#include "ap/util/concepts.hpp"
-#include "ap/util/string.hpp"
+#include "argon/detail/argument_name.hpp"
+#include "argon/util/concepts.hpp"
+#include "argon/util/string.hpp"
#include
#include
@@ -20,7 +20,7 @@
#include
#include
-namespace ap::detail {
+namespace argon::detail {
/// @brief A structure used to represent an argument's parameter description.
struct parameter_descriptor {
@@ -49,7 +49,7 @@ class help_builder {
/**
* @brief Adds a parameter descriptor with the given value.
- * @tparam T The type of the parameter; must satisfy the @ref ap::util::c_writable concept.
+ * @tparam T The type of the parameter; must satisfy the @ref argon::util::c_writable concept.
* @param param_name The parameter's name.
* @param value The parameter's value.
*/
@@ -62,7 +62,7 @@ class help_builder {
/**
* @brief Adds a range parameter descriptor with the given value.
- * @tparam R The type of the parameter range. The value type of R must satisfy the @ref ap::util::c_writable concept.
+ * @tparam R The type of the parameter range. The value type of R must satisfy the @ref argon::util::c_writable concept.
* @param param_name The parameter's name.
* @param range The parameter value range.
* @param delimiter The delimiter used to separate the range values.
@@ -189,4 +189,4 @@ class help_builder {
static constexpr std::string_view default_delimiter = ", ";
};
-} // namespace ap::detail
+} // namespace argon::detail
diff --git a/include/ap/exceptions.hpp b/include/argon/exceptions.hpp
similarity index 92%
rename from include/ap/exceptions.hpp
rename to include/argon/exceptions.hpp
index 9670b285..0f27f63c 100644
--- a/include/ap/exceptions.hpp
+++ b/include/argon/exceptions.hpp
@@ -1,18 +1,18 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/exceptions.hpp
+/// @file argon/exceptions.hpp
#pragma once
-#include "ap/detail/argument_name.hpp"
-#include "ap/util/string.hpp"
-#include "ap/util/typing.hpp"
+#include "argon/detail/argument_name.hpp"
+#include "argon/util/string.hpp"
+#include "argon/util/typing.hpp"
#include
-namespace ap {
+namespace argon {
/// @brief Base type for the argument parser functionality errors/exceptions.
struct argument_parser_exception : public std::runtime_error {
@@ -99,4 +99,4 @@ struct lookup_failure : public argument_parser_exception {
}
};
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/nargs/range.hpp b/include/argon/nargs/range.hpp
similarity index 95%
rename from include/ap/nargs/range.hpp
rename to include/argon/nargs/range.hpp
index 7d115bbc..d2ae498d 100644
--- a/include/ap/nargs/range.hpp
+++ b/include/argon/nargs/range.hpp
@@ -1,9 +1,9 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/nargs/range.hpp
+ * @file argon/nargs/range.hpp
* @brief Defines the `nargs::range` class and it's builder functions.
*/
@@ -13,7 +13,7 @@
#include
#include
-namespace ap::nargs {
+namespace argon::nargs {
using count_type = std::size_t;
@@ -164,4 +164,4 @@ class range {
return range(min_bound, max_bound);
}
-} // namespace ap::nargs
+} // namespace argon::nargs
diff --git a/include/ap/types.hpp b/include/argon/types.hpp
similarity index 84%
rename from include/ap/types.hpp
rename to include/argon/types.hpp
index 0ee9ce4b..4714b719 100644
--- a/include/ap/types.hpp
+++ b/include/argon/types.hpp
@@ -1,8 +1,8 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
-/// @file ap/types.hpp
+/// @file argon/types.hpp
#pragma once
@@ -10,7 +10,7 @@
#include
#include
-namespace ap {
+namespace argon {
/**
* @brief A type representing the absence of a value.
@@ -37,4 +37,4 @@ struct version {
}
};
-} // namespace ap
+} // namespace argon
diff --git a/include/ap/util/concepts.hpp b/include/argon/util/concepts.hpp
similarity index 93%
rename from include/ap/util/concepts.hpp
rename to include/argon/util/concepts.hpp
index 3dc95bb1..244fd1da 100644
--- a/include/ap/util/concepts.hpp
+++ b/include/argon/util/concepts.hpp
@@ -1,23 +1,23 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/util/concepts.hpp
+ * @file argon/util/concepts.hpp
* @brief Provides the general concept definitions.
*/
#pragma once
-#include "ap/types.hpp"
+#include "argon/types.hpp"
#include
#include
-namespace ap::util {
+namespace argon::util {
/**
- * @brief The concept is satisfied when `T` is @ref ap::none_type.
+ * @brief The concept is satisfied when `T` is @ref argon::none_type.
* @tparam T Type to check.
* @ingroup util
*/
@@ -63,7 +63,7 @@ concept c_arithmetic = std::is_arithmetic_v;
*/
template
concept c_argument_value_type =
- std::same_as
+ std::same_as
or (std::semiregular and (c_trivially_readable or c_readable));
/**
@@ -162,4 +162,4 @@ template
concept c_forward_iterator_of =
std::input_iterator and c_valid_type, V, TV>;
-} // namespace ap::util
+} // namespace argon::util
diff --git a/include/ap/util/ranges.hpp b/include/argon/util/ranges.hpp
similarity index 68%
rename from include/ap/util/ranges.hpp
rename to include/argon/util/ranges.hpp
index 5de2a91a..867579fa 100644
--- a/include/ap/util/ranges.hpp
+++ b/include/argon/util/ranges.hpp
@@ -1,20 +1,20 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/util/ranges.hpp
+ * @file argon/util/ranges.hpp
* @brief Provides common ranges utility functions.
*/
#pragma once
-#include "ap/util/concepts.hpp"
+#include "argon/util/concepts.hpp"
#include
#include
-namespace ap::util {
+namespace argon::util {
/**
* @brief Casts a range of `std::any` to a range of type `T`.
@@ -25,10 +25,10 @@ namespace ap::util {
* @ingroup util
*/
template
-auto any_range_cast_view(const c_range_of auto& range) {
+constexpr auto any_range_cast_view(const c_range_of auto& range) {
return range | std::views::transform([](const std::any& value) -> T {
return std::any_cast(value);
});
}
-} // namespace ap::util
+} // namespace argon::util
diff --git a/include/ap/util/string.hpp b/include/argon/util/string.hpp
similarity index 80%
rename from include/ap/util/string.hpp
rename to include/argon/util/string.hpp
index 79a108ee..7a9ce424 100644
--- a/include/ap/util/string.hpp
+++ b/include/argon/util/string.hpp
@@ -1,25 +1,25 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/util/string.hpp
+ * @file argon/util/string.hpp
* @brief Provides common string utility functions.
*/
#pragma once
-#include "ap/util/concepts.hpp"
+#include "argon/util/concepts.hpp"
#include
#include
#include
-namespace ap::util {
+namespace argon::util {
/**
* @brief Converts a value to `std::string`.
- * @tparam T The value type (must satisfy the @ref ap::util::c_writable concept).
+ * @tparam T The value type (must satisfy the @ref argon::util::c_writable concept).
* @param value The value to convert.
* @ingroup util
*/
@@ -41,7 +41,6 @@ template
* @param range The input range to join.
* @param delimiter The separator string to insert between elements.
* @return A single string with all elements joined by the delimiter.
- * \todo Replace with std::views::join after transition to C++23.
* @ingroup util
*/
template
@@ -61,4 +60,4 @@ requires(c_writable>)
return oss.str();
}
-} // namespace ap::util
+} // namespace argon::util
diff --git a/include/ap/util/typing.hpp b/include/argon/util/typing.hpp
similarity index 87%
rename from include/ap/util/typing.hpp
rename to include/argon/util/typing.hpp
index d3f2e0d4..7da1edbc 100644
--- a/include/ap/util/typing.hpp
+++ b/include/argon/util/typing.hpp
@@ -1,9 +1,9 @@
-// Copyright (c) 2023-2025 Jakub Musiał
-// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
+// Copyright (c) 2023-2026 Jakub Musiał
+// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).
// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
/**
- * @file ap/util/typing.hpp
+ * @file argon/util/typing.hpp
* @brief Provides common typing utility functions.
*/
@@ -15,7 +15,7 @@
#include
#include
-namespace ap::util {
+namespace argon::util {
/**
* @brief Retrieves the demangled name of a type `T`.
@@ -48,4 +48,4 @@ constexpr std::string_view get_demangled_type_name() {
#endif
}
-} // namespace ap::util
+} // namespace argon::util
diff --git a/scripts/check_license.py b/scripts/check_license.py
index 6442fa20..b6d5cd4c 100644
--- a/scripts/check_license.py
+++ b/scripts/check_license.py
@@ -1,19 +1,18 @@
import argparse
import sys
-
from collections.abc import Iterable
from enum import IntEnum
from pathlib import Path
from common import find_files
-
LICENCE_INFO = [
- "// Copyright (c) 2023-2025 Jakub Musiał",
- "// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).",
+ "// Copyright (c) 2023-2026 Jakub Musiał",
+ "// This file is part of the CPP-ARGON project (https://github.com/SpectraL519/cpp-argon).",
"// Licensed under the MIT License. See the LICENSE file in the project root for full license information.",
]
+
class DefaultParameters:
search_paths: list[str] = ["include", "source"]
file_patterns: list[str] = ["*.cpp", "*.hpp", "*.c", "*.h"]
@@ -24,28 +23,31 @@ class DefaultParameters:
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
- "-p", "--search-paths",
+ "-p",
+ "--search-paths",
type=str,
default=DefaultParameters.search_paths,
nargs="*",
action="extend",
- help="list of search directory paths"
+ help="list of search directory paths",
)
parser.add_argument(
- "-f", "--file-patterns",
+ "-f",
+ "--file-patterns",
type=str,
default=DefaultParameters.file_patterns,
nargs="*",
action="extend",
- help="list of file patterns to include"
+ help="list of file patterns to include",
)
parser.add_argument(
- "-e", "--exclude-paths",
+ "-e",
+ "--exclude-paths",
type=str,
default=DefaultParameters.exclude_paths,
nargs="*",
action="extend",
- help="list of directory paths to exclude"
+ help="list of directory paths to exclude",
)
return vars(parser.parse_args())
@@ -63,6 +65,7 @@ def check_licence(expected_licence: Iterable[str], files: set[Path]) -> int:
print(f"Files to check: {n_files}")
return_code = None
+
def _set_return_code(c: ReturnCode):
nonlocal return_code
return_code = c if not return_code else return_code
@@ -80,13 +83,14 @@ def _check_file(file: Path):
print(f"[error] File `{file}` to short")
return
- matching_lines = [lines[i] == expected_licence[i] for i in range(n_licence_lines)]
+ matching_lines = [
+ lines[i] == expected_licence[i] for i in range(n_licence_lines)
+ ]
correct_licence = all(matching_lines)
if not correct_licence:
- missing_info = any(matching_lines)
- if missing_info:
+ if any(matching_lines):
_set_return_code(ReturnCode.invalid_licence)
- errors.append(f"[error] Incomplete license info in file `{file}`")
+ errors.append(f"[error] Incorrect license info in file `{file}`")
else:
_set_return_code(ReturnCode.missing_licence)
errors.append(f"[error] Missing license info in file `{file}`")
@@ -108,7 +112,7 @@ def _check_file(file: Path):
def main(
search_paths: Iterable[str],
file_patterns: Iterable[str],
- exclude_paths: Iterable[str]
+ exclude_paths: Iterable[str],
):
files_to_check = find_files(search_paths, file_patterns, exclude_paths)
sys.exit(check_licence(LICENCE_INFO, files_to_check))
diff --git a/scripts/postprocess_doxyhtml.py b/scripts/postprocess_doxyhtml.py
index a2ec7c16..a8eef7d8 100644
--- a/scripts/postprocess_doxyhtml.py
+++ b/scripts/postprocess_doxyhtml.py
@@ -4,6 +4,14 @@
from bs4 import BeautifulSoup
+IMAGE_STYLE_RULES = [
+ {
+ "alt": "CPP-ARGON",
+ "style": "display: block; margin: 1.5em auto;"
+ }
+]
+
+
def encode_md_link(path_str: str) -> str:
"""
Encode a Markdown filepath according to Doxygen's rules:
@@ -87,12 +95,36 @@ def remove_mainpage_title(content: str, filename: str) -> str:
return str(soup)
+def process_images(content: str, html_path: Path) -> str:
+ soup = BeautifulSoup(content, 'html.parser')
+
+ for img in soup.find_all('img'):
+ src = img.get('src')
+ if not src:
+ continue
+
+ if src.startswith(('http://', 'https://', 'data:')):
+ continue
+
+ filename = Path(src).name
+ if (html_path.parent / filename).exists():
+ img['src'] = filename # Align the file path
+
+ alt = img.get('alt', '')
+ for rule in IMAGE_STYLE_RULES: # Apply image style rules
+ if ("filaneme" in rule and filename == rule["filename"]) or ("alt" in rule and alt == rule["alt"]):
+ img['style'] = f"{img.get('style', '')}; {rule.get('style', '')}".strip('; ')
+
+ return str(soup)
+
+
def process_file(f: Path):
content = f.read_text(encoding='utf-8')
content = process_md_refs(content)
content = process_gfm(content)
content = process_heading_code_blocks(content)
content = remove_mainpage_title(content, f.name)
+ content = process_images(content, f)
f.write_text(content, encoding='utf-8')
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f2eb137f..30c585e0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.12)
# Project
-project(cpp-ap-test)
+project(cpp-argon-test)
# Set compile options
if (MSVC)
@@ -43,4 +43,4 @@ set_target_properties(run_uts PROPERTIES
)
target_include_directories(run_uts PRIVATE ${INCLUDE_DIRS})
target_compile_definitions(run_uts PRIVATE "AP_TESTING")
-target_link_libraries(run_uts PRIVATE cpp-ap)
+target_link_libraries(run_uts PRIVATE cpp-argon)
diff --git a/tests/include/argument_parser_test_fixture.hpp b/tests/include/argument_parser_test_fixture.hpp
index 564a938f..1dad91b3 100644
--- a/tests/include/argument_parser_test_fixture.hpp
+++ b/tests/include/argument_parser_test_fixture.hpp
@@ -1,25 +1,25 @@
#pragma once
-#include
+#include
#include
#include
-using ap::optional_argument;
-using ap::positional_argument;
-using ap::detail::argument_name;
-using ap::detail::argument_token;
-using ap::util::c_argument_value_type;
-using ap::util::c_forward_iterator_of;
-using ap::util::type_validator;
+using argon::optional_argument;
+using argon::positional_argument;
+using argon::detail::argument_name;
+using argon::detail::argument_token;
+using argon::util::c_argument_value_type;
+using argon::util::c_forward_iterator_of;
+using argon::util::type_validator;
-namespace ap_testing {
+namespace argon_testing {
struct argument_parser_test_fixture {
- using arg_ptr_t = ap::argument_parser::arg_ptr_t;
- using arg_token_vec_t = ap::argument_parser::arg_token_vec_t;
+ using arg_ptr_t = argon::argument_parser::arg_ptr_t;
+ using arg_token_vec_t = argon::argument_parser::arg_token_vec_t;
- using parsing_state = ap::argument_parser::parsing_state;
+ using parsing_state = argon::argument_parser::parsing_state;
using argument_value_type = std::string;
using invalid_argument_value_type = int;
@@ -196,10 +196,10 @@ struct argument_parser_test_fixture {
return std::format("No values parsed for a required argument [{}]", arg_name.str());
}
- ap::argument_parser sut{program_name};
+ argon::argument_parser sut{program_name};
parsing_state state{sut};
static constexpr std::string_view program_name = "program";
};
-} // namespace ap_testing
+} // namespace argon_testing
diff --git a/tests/include/argument_test_fixture.hpp b/tests/include/argument_test_fixture.hpp
index df15671c..151bfea8 100644
--- a/tests/include/argument_test_fixture.hpp
+++ b/tests/include/argument_test_fixture.hpp
@@ -1,16 +1,16 @@
#pragma once
-#include
-#include
+#include
+#include
-using ap::argument;
-using ap::argument_type;
-using ap::detail::argument_name;
-using ap::detail::help_builder;
-using ap::util::as_string;
-using ap::util::c_argument_value_type;
+using argon::argument;
+using argon::argument_type;
+using argon::detail::argument_name;
+using argon::detail::help_builder;
+using argon::util::as_string;
+using argon::util::c_argument_value_type;
-namespace ap_testing {
+namespace argon_testing {
struct argument_test_fixture {
template
@@ -129,4 +129,4 @@ struct argument_test_fixture {
}
};
-} // namespace ap_testing
+} // namespace argon_testing
diff --git a/tests/include/utility.hpp b/tests/include/utility.hpp
index 5e2fd0e7..916dea09 100644
--- a/tests/include/utility.hpp
+++ b/tests/include/utility.hpp
@@ -1,22 +1,22 @@
#pragma once
-#include
+#include
-namespace ap_testing {
+namespace argon_testing {
template
void discard_result(T&&) {
// do nothing
}
-template
-bool is_positional(const ap::detail::argument_base& arg) {
- return dynamic_cast*>(&arg);
+template
+bool is_positional(const argon::detail::argument_base& arg) {
+ return dynamic_cast*>(&arg);
}
-template
-bool is_optional(const ap::detail::argument_base& arg) {
- return dynamic_cast*>(&arg);
+template
+bool is_optional(const argon::detail::argument_base& arg) {
+ return dynamic_cast*>(&arg);
}
-} // namespace ap_testing
+} // namespace argon_testing
diff --git a/tests/source/test_argument_name.cpp b/tests/source/test_argument_name.cpp
index 60856ac5..6cd83bbd 100644
--- a/tests/source/test_argument_name.cpp
+++ b/tests/source/test_argument_name.cpp
@@ -1,10 +1,10 @@
#include "doctest.h"
-#include
+#include
#include