[med-svn] [Git][med-team/libargs][master] 6 commits: import catch2 version 2.13.8 to fix build failure with glibc 2.34
Andreas Tille (@tille)
gitlab at salsa.debian.org
Wed Apr 13 09:25:43 BST 2022
Andreas Tille pushed to branch master at Debian Med / libargs
Commits:
57965582 by Andreas Tille at 2022-04-13T10:09:03+02:00
import catch2 version 2.13.8 to fix build failure with glibc 2.34
- - - - -
eb15ec86 by Andreas Tille at 2022-04-13T10:09:32+02:00
routine-update: New upstream version
- - - - -
00384f93 by Andreas Tille at 2022-04-13T10:09:33+02:00
New upstream version 6.3.0
- - - - -
ed7693bf by Andreas Tille at 2022-04-13T10:09:33+02:00
Update upstream source from tag 'upstream/6.3.0'
Update to upstream version '6.3.0'
with Debian dir 5810666a5d1cc82d8c306f40828647308aa39cfd
- - - - -
e868b457 by Andreas Tille at 2022-04-13T10:18:23+02:00
Upstream has importet a working catch.hpp version
- - - - -
23a4d611 by Andreas Tille at 2022-04-13T10:20:06+02:00
Upload to unstable
- - - - -
10 changed files:
- CMakeLists.txt
- Doxyfile
- README.md
- args.hxx
- catch.hpp
- conanfile.py
- debian/changelog
- meson.build
- + packaging/pkgconfig.pc.in
- test.cxx
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -20,15 +20,26 @@
# IN THE SOFTWARE.
cmake_minimum_required(VERSION 3.2)
+
+include(GNUInstallDirs)
+string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
+
+
set(ARGS_MAIN_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(ARGS_MAIN_PROJECT ON)
endif()
project(args CXX)
+set(PROJECT_DESCRIPTION "A simple, small, flexible, single-header C++11 argument parsing library. that is designed to appear somewhat similar to Python's argparse.")
+set(PROJECT_HOMEPAGE_URL "https://github.com/Taywee/args")
+set(PROJECT_VERSION 6.3.0)
option(ARGS_BUILD_EXAMPLE "Build example" ON)
option(ARGS_BUILD_UNITTESTS "Build unittests" ON)
+set(CMAKE_CONFIG_DEST "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME}")
+set(PackagingTemplatesDir "${CMAKE_CURRENT_SOURCE_DIR}/packaging")
+
add_library(args INTERFACE)
target_include_directories(args INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
@@ -77,3 +88,35 @@ if (ARGS_BUILD_UNITTESTS)
add_test(NAME "test" COMMAND argstest)
add_test(NAME "test-multiple-inclusion" COMMAND argstest-multiple-inclusion)
endif()
+
+set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME} developers")
+set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
+set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
+set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
+set(CPACK_PACKAGE_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}")
+set(CPACK_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
+set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_MAINTAINER}")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
+
+set(CPACK_DEBIAN_PACKAGE_NAME "lib${PROJECT_NAME}-dev")
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6-dev")
+set(CPACK_DEBIAN_PACKAGE_SUGGESTS "cmake, pkg-config, pkg-conf")
+
+set(CPACK_RPM_PACKAGE_NAME "lib${PROJECT_NAME}-devel")
+set(CPACK_RPM_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}")
+
+set(CPACK_DEB_COMPONENT_INSTALL ON)
+set(CPACK_RPM_COMPONENT_INSTALL ON)
+set(CPACK_NSIS_COMPONENT_INSTALL ON)
+set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
+
+set(PKG_CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
+configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" "${PKG_CONFIG_FILE_NAME}" @ONLY)
+install(FILES "${PKG_CONFIG_FILE_NAME}"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig"
+)
+
+include(CPack)
=====================================
Doxyfile
=====================================
@@ -38,7 +38,7 @@ PROJECT_NAME = "args"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 6.2.0
+PROJECT_NUMBER = 6.3.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
=====================================
README.md
=====================================
@@ -42,27 +42,27 @@ describe the usage, as it's built to push the boundaries.
It:
* Lets you handle flags, flag+value, and positional arguments simply and
- elegently, with the full help of static typechecking.
+ elegantly, with the full help of static typechecking.
* Allows you to use your own types in a pretty simple way.
* Lets you use count flags, and lists of all argument-accepting types.
* Allows full validation of groups of required arguments, though output isn't
- pretty when something fails group validation. User validation functions are
- accepted. Groups are fully nestable.
+ pretty when something fails group validation. User validation functions are
+ accepted. Groups are fully nestable.
* Generates pretty help for you, with some good tweakable parameters.
* Lets you customize all prefixes and most separators, allowing you to create
- an infinite number of different argument syntaxes
+ an infinite number of different argument syntaxes.
* Lets you parse, by default, any type that has a stream extractor operator for
- it. If this doesn't work for your uses, you can supply a function and parse
+ it. If this doesn't work for your uses, you can supply a function and parse
the string yourself if you like.
* Lets you decide not to allow separate-argument value flags or joined ones
(like disallowing `--foo bar`, requiring `--foo=bar`, or the inverse, or the
same for short options).
* Allows you to create subparsers, to reuse arguments for multiple commands and
- to refactor your command's logic to a function or lambda
+ to refactor your command's logic to a function or lambda.
* Allows one value flag to take a specific number of values (like `--foo first
second`, where --foo slurps both arguments).
-* Allows you to have value flags only optionally accept values
-* Provides autocompletion for bash
+* Allows you to have value flags only optionally accept values.
+* Provides autocompletion for bash.
# What does it not do?
=====================================
args.hxx
=====================================
@@ -2,7 +2,7 @@
*
* https://github.com/Taywee/args
*
- * Copyright (c) 2016-2020 Taylor C. Richberger <taywee at gmx.com> and Pavel
+ * Copyright (c) 2016-2021 Taylor C. Richberger <taywee at gmx.com> and Pavel
* Belikov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -33,10 +33,10 @@
#ifndef ARGS_HXX
#define ARGS_HXX
-#define ARGS_VERSION "6.2.6"
+#define ARGS_VERSION "6.3.0"
#define ARGS_VERSION_MAJOR 6
-#define ARGS_VERSION_MINOR 2
-#define ARGS_VERSION_PATCH 6
+#define ARGS_VERSION_MINOR 3
+#define ARGS_VERSION_PATCH 0
#include <algorithm>
#include <iterator>
@@ -3242,6 +3242,14 @@ namespace args
return count;
}
+ int &operator *() noexcept {
+ return count;
+ }
+
+ const int &operator *() const noexcept {
+ return count;
+ }
+
virtual void Reset() noexcept override
{
FlagBase::Reset();
@@ -3394,6 +3402,34 @@ namespace args
return value;
}
+ /** Get the value
+ */
+ T &operator *() noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ const T &operator *() const noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ T *operator ->() noexcept
+ {
+ return &value;
+ }
+
+ /** Get the value
+ */
+ const T *operator ->() const noexcept
+ {
+ return &value;
+ }
+
/** Get the default value
*/
const T &GetDefault() noexcept
@@ -3523,6 +3559,34 @@ namespace args
return values;
}
+ /** Get the value
+ */
+ List<T> &operator *() noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ const List<T> &operator *() const noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ List<T> *operator ->() noexcept
+ {
+ return &values;
+ }
+
+ /** Get the values
+ */
+ const List<T> *operator ->() const noexcept
+ {
+ return &values;
+ }
+
iterator begin() noexcept
{
return values.begin();
@@ -3635,6 +3699,34 @@ namespace args
return values;
}
+ /** Get the value
+ */
+ Container &operator *() noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ const Container &operator *() const noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ Container *operator ->() noexcept
+ {
+ return &values;
+ }
+
+ /** Get the values
+ */
+ const Container *operator ->() const noexcept
+ {
+ return &values;
+ }
+
virtual std::string Name() const override
{
return name + std::string("...");
@@ -3768,6 +3860,34 @@ namespace args
return value;
}
+ /** Get the value
+ */
+ T &operator *() noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ const T &operator *() const noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ T *operator ->() noexcept
+ {
+ return &value;
+ }
+
+ /** Get the value
+ */
+ const T *operator ->() const noexcept
+ {
+ return &value;
+ }
+
virtual void Reset() noexcept override
{
ValueFlagBase::Reset();
@@ -3862,6 +3982,34 @@ namespace args
return values;
}
+ /** Get the value
+ */
+ Container &operator *() noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ const Container &operator *() const noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ Container *operator ->() noexcept
+ {
+ return &values;
+ }
+
+ /** Get the values
+ */
+ const Container *operator ->() const noexcept
+ {
+ return &values;
+ }
+
virtual std::string Name() const override
{
return name + std::string("...");
@@ -3962,6 +4110,34 @@ namespace args
return value;
}
+ /** Get the value
+ */
+ T &operator *() noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ const T &operator *() const noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ T *operator ->() noexcept
+ {
+ return &value;
+ }
+
+ /** Get the value
+ */
+ const T *operator ->() const noexcept
+ {
+ return &value;
+ }
+
virtual void Reset() noexcept override
{
PositionalBase::Reset();
@@ -4039,6 +4215,34 @@ namespace args
return values;
}
+ /** Get the value
+ */
+ Container &operator *() noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ const Container &operator *() const noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ Container *operator ->() noexcept
+ {
+ return &values;
+ }
+
+ /** Get the values
+ */
+ const Container *operator ->() const noexcept
+ {
+ return &values;
+ }
+
virtual void Reset() noexcept override
{
PositionalBase::Reset();
@@ -4160,6 +4364,34 @@ namespace args
return value;
}
+ /** Get the value
+ */
+ T &operator *() noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ const T &operator *() const noexcept
+ {
+ return value;
+ }
+
+ /** Get the value
+ */
+ T *operator ->() noexcept
+ {
+ return &value;
+ }
+
+ /** Get the value
+ */
+ const T *operator ->() const noexcept
+ {
+ return &value;
+ }
+
virtual void Reset() noexcept override
{
PositionalBase::Reset();
@@ -4255,6 +4487,34 @@ namespace args
return values;
}
+ /** Get the value
+ */
+ Container &operator *() noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ const Container &operator *() const noexcept
+ {
+ return values;
+ }
+
+ /** Get the values
+ */
+ Container *operator ->() noexcept
+ {
+ return &values;
+ }
+
+ /** Get the values
+ */
+ const Container *operator ->() const noexcept
+ {
+ return &values;
+ }
+
virtual std::string Name() const override
{
return name + std::string("...");
=====================================
catch.hpp
=====================================
The diff for this file was not included because it is too large.
=====================================
conanfile.py
=====================================
@@ -2,7 +2,7 @@ from conans import ConanFile
class ArgsConan(ConanFile):
name = "args"
- version = "6.2.0"
+ version = "6.3.0"
url = "https://github.com/Taywee/args"
description = "A simple header-only C++ argument parser library."
license = "MIT"
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libargs (6.3.0-1) unstable; urgency=medium
+
+ * New upstream version
+ Closes: #1009611
+
+ -- Andreas Tille <tille at debian.org> Wed, 13 Apr 2022 10:18:51 +0200
+
libargs (6.2.6-1) unstable; urgency=medium
* Fix watchfile to detect new versions on github (routine-update)
=====================================
meson.build
=====================================
@@ -1,5 +1,5 @@
project('args.hxx', ['cpp'],
- version: '6.2.2',
+ version: '6.3.0',
default_options: 'cpp_std=c++11',
license: 'MIT'
)
=====================================
packaging/pkgconfig.pc.in
=====================================
@@ -0,0 +1,7 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: @PROJECT_NAME@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+Cflags: -I${includedir}
=====================================
test.cxx
=====================================
@@ -59,9 +59,9 @@ TEST_CASE("Count flag works as expected", "[args]")
REQUIRE(foo);
REQUIRE(bar);
REQUIRE_FALSE(baz);
- REQUIRE(args::get(foo) == 4);
- REQUIRE(args::get(bar) == 10);
- REQUIRE(args::get(baz) == 7);
+ REQUIRE(*foo == 4);
+ REQUIRE(*bar == 10);
+ REQUIRE(*baz == 7);
}
TEST_CASE("Argument flags work as expected, with clustering", "[args]")
@@ -74,12 +74,12 @@ TEST_CASE("Argument flags work as expected, with clustering", "[args]")
args::Flag bix(parser, "BAZ", "test flag", {'x', "bix"});
parser.ParseArgs(std::vector<std::string>{"-bftest", "--baz=7.555e2", "--bim", "c"});
REQUIRE(foo);
- REQUIRE(args::get(foo) == "test");
+ REQUIRE(*foo == "test");
REQUIRE(bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) > 755.49 && args::get(baz) < 755.51));
+ REQUIRE((*baz > 755.49 && *baz < 755.51));
REQUIRE(bim);
- REQUIRE(args::get(bim) == 'c');
+ REQUIRE(*bim == 'c');
REQUIRE_FALSE(bix);
}
@@ -100,12 +100,12 @@ TEST_CASE("Unified argument lists for match work", "[args]")
args::Flag bix(parser, "BAZ", "test flag", {"bix"});
parser.ParseArgs(std::vector<std::string>{"-bftest", "--baz=7.555e2", "--bim", "c"});
REQUIRE(foo);
- REQUIRE(args::get(foo) == "test");
+ REQUIRE(*foo == "test");
REQUIRE(bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) > 755.49 && args::get(baz) < 755.51));
+ REQUIRE((*baz > 755.49 && *baz < 755.51));
REQUIRE(bim);
- REQUIRE(args::get(bim) == 'c');
+ REQUIRE(*bim == 'c');
REQUIRE_FALSE(bix);
}
@@ -115,9 +115,9 @@ TEST_CASE("Get can be assigned to for non-reference types", "[args]")
args::ValueFlag<std::string> foo(parser, "FOO", "test flag", {'f', "foo"});
parser.ParseArgs(std::vector<std::string>{"--foo=test"});
REQUIRE(foo);
- REQUIRE(args::get(foo) == "test");
- args::get(foo) = "bar";
- REQUIRE(args::get(foo) == "bar");
+ REQUIRE(*foo == "test");
+ *foo = "bar";
+ REQUIRE(*foo == "bar");
}
TEST_CASE("Invalid argument parsing throws parsing exceptions", "[args]")
@@ -134,7 +134,7 @@ TEST_CASE("Argument flag lists work as expected", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::ValueFlagList<int> foo(parser, "FOO", "test flag", {'f', "foo"});
parser.ParseArgs(std::vector<std::string>{"--foo=7", "-f2", "-f", "9", "--foo", "42"});
- REQUIRE((args::get(foo) == std::vector<int>{7, 2, 9, 42}));
+ REQUIRE((*foo == std::vector<int>{7, 2, 9, 42}));
}
TEST_CASE("Argument flag lists use default values", "[args]")
@@ -142,7 +142,7 @@ TEST_CASE("Argument flag lists use default values", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::ValueFlagList<int> foo(parser, "FOO", "test flag", {'f', "foo"}, {9, 7, 5});
parser.ParseArgs(std::vector<std::string>());
- REQUIRE((args::get(foo) == std::vector<int>{9, 7, 5}));
+ REQUIRE((*foo == std::vector<int>{9, 7, 5}));
}
TEST_CASE("Argument flag lists replace default values", "[args]")
@@ -150,7 +150,7 @@ TEST_CASE("Argument flag lists replace default values", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::ValueFlagList<int> foo(parser, "FOO", "test flag", {'f', "foo"}, {9, 7, 5});
parser.ParseArgs(std::vector<std::string>{"--foo=7", "-f2", "-f", "9", "--foo", "42"});
- REQUIRE((args::get(foo) == std::vector<int>{7, 2, 9, 42}));
+ REQUIRE((*foo == std::vector<int>{7, 2, 9, 42}));
}
TEST_CASE("Positional lists work as expected", "[args]")
@@ -158,7 +158,7 @@ TEST_CASE("Positional lists work as expected", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::PositionalList<int> foo(parser, "FOO", "test flag");
parser.ParseArgs(std::vector<std::string>{"7", "2", "9", "42"});
- REQUIRE((args::get(foo) == std::vector<int>{7, 2, 9, 42}));
+ REQUIRE((*foo == std::vector<int>{7, 2, 9, 42}));
}
TEST_CASE("Positional lists use default values", "[args]")
@@ -166,7 +166,7 @@ TEST_CASE("Positional lists use default values", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::PositionalList<int> foo(parser, "FOO", "test flag", {9, 7, 5});
parser.ParseArgs(std::vector<std::string>());
- REQUIRE((args::get(foo) == std::vector<int>{9, 7, 5}));
+ REQUIRE((*foo == std::vector<int>{9, 7, 5}));
}
TEST_CASE("Positional lists replace default values", "[args]")
@@ -174,7 +174,7 @@ TEST_CASE("Positional lists replace default values", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::PositionalList<int> foo(parser, "FOO", "test flag", {9, 7, 5});
parser.ParseArgs(std::vector<std::string>{"7", "2", "9", "42"});
- REQUIRE((args::get(foo) == std::vector<int>{7, 2, 9, 42}));
+ REQUIRE((*foo == std::vector<int>{7, 2, 9, 42}));
}
#include <unordered_set>
@@ -184,7 +184,7 @@ TEST_CASE("Argument flag lists work with sets", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::ValueFlagList<std::string, std::unordered_set> foo(parser, "FOO", "test flag", {'f', "foo"});
parser.ParseArgs(std::vector<std::string>{"--foo=7", "-fblah", "-f", "9", "--foo", "blah"});
- REQUIRE((args::get(foo) == std::unordered_set<std::string>{"7", "9", "blah"}));
+ REQUIRE((*foo == std::unordered_set<std::string>{"7", "9", "blah"}));
}
TEST_CASE("Positional arguments and positional argument lists work as expected", "[args]")
@@ -195,11 +195,11 @@ TEST_CASE("Positional arguments and positional argument lists work as expected",
args::PositionalList<char> baz(parser, "BAZ", "test flag");
parser.ParseArgs(std::vector<std::string>{"this is a test flag", "0", "a", "b", "c", "x", "y", "z"});
REQUIRE(foo);
- REQUIRE((args::get(foo) == "this is a test flag"));
+ REQUIRE((*foo == "this is a test flag"));
REQUIRE(bar);
- REQUIRE(!args::get(bar));
+ REQUIRE(!*bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) == std::vector<char>{'a', 'b', 'c', 'x', 'y', 'z'}));
+ REQUIRE((*baz == std::vector<char>{'a', 'b', 'c', 'x', 'y', 'z'}));
}
TEST_CASE("The option terminator works as expected", "[args]")
@@ -213,31 +213,31 @@ TEST_CASE("The option terminator works as expected", "[args]")
args::ValueFlag<double> obaz(parser, "BAZ", "test flag", {'a', "baz"});
parser.ParseArgs(std::vector<std::string>{"--foo", "this is a test flag", "0", "a", "b", "--baz", "7.0", "c", "x", "y", "z"});
REQUIRE(foo);
- REQUIRE((args::get(foo) == "this is a test flag"));
+ REQUIRE((*foo == "this is a test flag"));
REQUIRE(bar);
- REQUIRE(!args::get(bar));
+ REQUIRE(!*bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) == std::vector<std::string>{"a", "b", "c", "x", "y", "z"}));
+ REQUIRE((*baz == std::vector<std::string>{"a", "b", "c", "x", "y", "z"}));
REQUIRE(ofoo);
REQUIRE(!obar);
REQUIRE(obaz);
parser.ParseArgs(std::vector<std::string>{"--foo", "this is a test flag", "0", "a", "--", "b", "--baz", "7.0", "c", "x", "y", "z"});
REQUIRE(foo);
- REQUIRE((args::get(foo) == "this is a test flag"));
+ REQUIRE((*foo == "this is a test flag"));
REQUIRE(bar);
- REQUIRE(!args::get(bar));
+ REQUIRE(!*bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) == std::vector<std::string>{"a", "b", "--baz", "7.0", "c", "x", "y", "z"}));
+ REQUIRE((*baz == std::vector<std::string>{"a", "b", "--baz", "7.0", "c", "x", "y", "z"}));
REQUIRE(ofoo);
REQUIRE(!obar);
REQUIRE(!obaz);
parser.ParseArgs(std::vector<std::string>{"--foo", "--", "this is a test flag", "0", "a", "b", "--baz", "7.0", "c", "x", "y", "z"});
REQUIRE(foo);
- REQUIRE((args::get(foo) == "this is a test flag"));
+ REQUIRE((*foo == "this is a test flag"));
REQUIRE(bar);
- REQUIRE(!args::get(bar));
+ REQUIRE(!*bar);
REQUIRE(baz);
- REQUIRE((args::get(baz) == std::vector<std::string>{"a", "b", "--baz", "7.0", "c", "x", "y", "z"}));
+ REQUIRE((*baz == std::vector<std::string>{"a", "b", "--baz", "7.0", "c", "x", "y", "z"}));
REQUIRE(ofoo);
REQUIRE(!obar);
REQUIRE(!obaz);
@@ -248,7 +248,7 @@ TEST_CASE("Positional lists work with sets", "[args]")
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::PositionalList<std::string, std::unordered_set> foo(parser, "FOO", "test positional");
parser.ParseArgs(std::vector<std::string>{"foo", "FoO", "bar", "baz", "foo", "9", "baz"});
- REQUIRE((args::get(foo) == std::unordered_set<std::string>{"foo", "FoO", "bar", "baz", "9"}));
+ REQUIRE((*foo == std::unordered_set<std::string>{"foo", "FoO", "bar", "baz", "9"}));
}
@@ -260,7 +260,7 @@ TEST_CASE("Positionals that are unspecified evaluate false", "[args]")
args::PositionalList<char> baz(parser, "BAZ", "test flag");
parser.ParseArgs(std::vector<std::string>{"this is a test flag again"});
REQUIRE(foo);
- REQUIRE((args::get(foo) == "this is a test flag again"));
+ REQUIRE((*foo == "this is a test flag again"));
REQUIRE_FALSE(bar);
REQUIRE_FALSE(baz);
}
@@ -354,10 +354,10 @@ TEST_CASE("Custom types work", "[args]")
args::Positional<std::tuple<int, int>> ints(parser, "INTS", "This takes a pair of integers.");
args::Positional<std::tuple<double, double>, DoublesReader> doubles(parser, "DOUBLES", "This takes a pair of doubles.");
parser.ParseArgs(std::vector<std::string>{"1,2", "3.8,4"});
- REQUIRE(std::get<0>(args::get(ints)) == 1);
- REQUIRE(std::get<1>(args::get(ints)) == 2);
- REQUIRE((std::get<0>(args::get(doubles)) > 3.79 && std::get<0>(args::get(doubles)) < 3.81));
- REQUIRE((std::get<1>(args::get(doubles)) > 3.99 && std::get<1>(args::get(doubles)) < 4.01));
+ REQUIRE(std::get<0>(*ints) == 1);
+ REQUIRE(std::get<1>(*ints) == 2);
+ REQUIRE((std::get<0>(*doubles) > 3.79 && std::get<0>(*doubles) < 3.81));
+ REQUIRE((std::get<1>(*doubles) > 3.99 && std::get<1>(*doubles) < 4.01));
}
TEST_CASE("Custom parser prefixes (dd-style)", "[args]")
@@ -372,11 +372,11 @@ TEST_CASE("Custom parser prefixes (dd-style)", "[args]")
args::ValueFlag<std::string> output(parser, "BLOCK SIZE", "Block size", {"of"});
parser.ParseArgs(std::vector<std::string>{"skip=8", "if=/dev/null"});
REQUIRE_FALSE(bs);
- REQUIRE(args::get(bs) == 512);
+ REQUIRE(*bs == 512);
REQUIRE(skip);
- REQUIRE(args::get(skip) == 8);
+ REQUIRE(*skip == 8);
REQUIRE(input);
- REQUIRE(args::get(input) == "/dev/null");
+ REQUIRE(*input == "/dev/null");
REQUIRE_FALSE(output);
}
@@ -392,11 +392,11 @@ TEST_CASE("Custom parser prefixes (Some Windows styles)", "[args]")
args::ValueFlag<std::string> output(parser, "BLOCK SIZE", "Block size", {"of"});
parser.ParseArgs(std::vector<std::string>{"/skip:8", "/if:/dev/null"});
REQUIRE_FALSE(bs);
- REQUIRE(args::get(bs) == 512);
+ REQUIRE(*bs == 512);
REQUIRE(skip);
- REQUIRE(args::get(skip) == 8);
+ REQUIRE(*skip == 8);
REQUIRE(input);
- REQUIRE(args::get(input) == "/dev/null");
+ REQUIRE(*input == "/dev/null");
REQUIRE_FALSE(output);
}
@@ -486,17 +486,17 @@ TEST_CASE("Mapping types work as needed", "[args]")
args::MapPositionalList<std::string, MappingEnum> mpl(parser, "MPL", "Maps string to an enum list", map);
parser.ParseArgs(std::vector<std::string>{"--mf=red", "--cimf=YeLLoW", "--mfl=bar", "foo", "--mfl=green", "red", "--mfl", "bar", "default"});
REQUIRE_FALSE(dmf);
- REQUIRE(args::get(dmf) == MappingEnum::def);
+ REQUIRE(*dmf == MappingEnum::def);
REQUIRE(mf);
- REQUIRE(args::get(mf) == MappingEnum::red);
+ REQUIRE(*mf == MappingEnum::red);
REQUIRE(cimf);
- REQUIRE(args::get(cimf) == MappingEnum::yellow);
+ REQUIRE(*cimf == MappingEnum::yellow);
REQUIRE(mfl);
- REQUIRE((args::get(mfl) == std::vector<MappingEnum>{MappingEnum::bar, MappingEnum::green, MappingEnum::bar}));
+ REQUIRE((*mfl == std::vector<MappingEnum>{MappingEnum::bar, MappingEnum::green, MappingEnum::bar}));
REQUIRE(mp);
- REQUIRE((args::get(mp) == MappingEnum::foo));
+ REQUIRE((*mp == MappingEnum::foo));
REQUIRE(mpl);
- REQUIRE((args::get(mpl) == std::vector<MappingEnum>{MappingEnum::red, MappingEnum::def}));
+ REQUIRE((*mpl == std::vector<MappingEnum>{MappingEnum::red, MappingEnum::def}));
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"--mf=YeLLoW"}), args::MapError);
}
@@ -526,7 +526,7 @@ TEST_CASE("An exception should be thrown when a single-argument flag is matched
REQUIRE_FALSE(bar);
REQUIRE_FALSE(bix);
REQUIRE(baz);
- REQUIRE(args::get(baz) == MappingEnum::green);
+ REQUIRE(*baz == MappingEnum::green);
}
TEST_CASE("Sub-parsers should work through kick-out", "[args]")
@@ -558,7 +558,7 @@ TEST_CASE("Sub-parsers should work through kick-out", "[args]")
REQUIRE(foo1);
REQUIRE_FALSE(bar1);
REQUIRE(sub);
- REQUIRE(args::get(sub) == MappingEnum::green);
+ REQUIRE(*sub == MappingEnum::green);
REQUIRE_FALSE(foo2);
REQUIRE(bar2);
}
@@ -603,7 +603,7 @@ TEST_CASE("Kick-out should work via all flags and value flags", "[args]")
REQUIRE(c2);
REQUIRE_FALSE(d2);
REQUIRE(bar);
- REQUIRE(args::get(bar) == "barvalue");
+ REQUIRE(*bar == "barvalue");
REQUIRE_FALSE(a3);
REQUIRE(b3);
REQUIRE_FALSE(c3);
@@ -617,7 +617,7 @@ TEST_CASE("Required flags work as expected", "[args]")
args::ValueFlag<int> bar(parser1, "bar", "bar", {'b', "bar"});
parser1.ParseArgs(std::vector<std::string>{"-f", "42"});
- REQUIRE(foo.Get() == 42);
+ REQUIRE(*foo == 42);
REQUIRE_THROWS_AS(parser1.ParseArgs(std::vector<std::string>{"-b4"}), args::RequiredError);
@@ -656,20 +656,20 @@ TEST_CASE("Implicit values work as expected", "[args]")
args::ImplicitValueFlag<int> j(parser, "parallel", "parallel", {'j', "parallel"}, 0, 1);
args::Flag foo(parser, "FOO", "test flag", {'f', "foo"});
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-j"}));
- REQUIRE(args::get(j) == 0);
+ REQUIRE(*j == 0);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-j4"}));
- REQUIRE(args::get(j) == 4);
+ REQUIRE(*j == 4);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-j", "4"}));
- REQUIRE(args::get(j) == 4);
+ REQUIRE(*j == 4);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-j", "-f"}));
- REQUIRE(args::get(j) == 0);
+ REQUIRE(*j == 0);
REQUIRE(foo);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-f"}));
- REQUIRE(args::get(j) == 1);
+ REQUIRE(*j == 1);
REQUIRE_FALSE(j);
}
@@ -685,23 +685,23 @@ TEST_CASE("Nargs work as expected", "[args]")
REQUIRE_THROWS_AS(args::Nargs(3, 2), args::UsageError);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-a", "1", "2"}));
- REQUIRE((args::get(a) == std::vector<int>{1, 2}));
+ REQUIRE((*a == std::vector<int>{1, 2}));
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-a", "1", "2", "-f"}));
- REQUIRE((args::get(a) == std::vector<int>{1, 2}));
- REQUIRE(args::get(f) == true);
+ REQUIRE((*a == std::vector<int>{1, 2}));
+ REQUIRE(f);
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-a", "1"}), args::ParseError);
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-a1"}), args::ParseError);
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-a1", "2"}), args::ParseError);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-b", "1", "-2", "-f"}));
- REQUIRE((args::get(b) == std::vector<int>{1, -2}));
- REQUIRE(args::get(f) == true);
+ REQUIRE((*b == std::vector<int>{1, -2}));
+ REQUIRE(f);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-b", "1", "2", "3"}));
- REQUIRE((args::get(b) == std::vector<int>{1, 2, 3}));
- REQUIRE(args::get(f) == false);
+ REQUIRE((*b == std::vector<int>{1, 2, 3}));
+ REQUIRE(!f);
std::vector<int> vec;
for (int be : b)
@@ -717,12 +717,12 @@ TEST_CASE("Nargs work as expected", "[args]")
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-a", "1", "2"}), args::ParseError);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-c", "-f"}));
- REQUIRE(args::get(c).empty());
- REQUIRE(args::get(f) == true);
+ REQUIRE(c->empty());
+ REQUIRE(f);
REQUIRE_NOTHROW(parser.ParseArgs(std::vector<std::string>{"-cf"}));
- REQUIRE((args::get(c) == std::vector<std::string>{"f"}));
- REQUIRE(args::get(f) == false);
+ REQUIRE((*c == std::vector<std::string>{"f"}));
+ REQUIRE(!f);
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-d"}), args::ParseError);
REQUIRE_THROWS_AS(parser.ParseArgs(std::vector<std::string>{"-b"}), args::ParseError);
@@ -741,8 +741,8 @@ TEST_CASE("Simple commands work as expected", "[args]")
p.ParseArgs(std::vector<std::string>{"add", "--git-dir", "A", "B", "C", "D"});
REQUIRE(add);
REQUIRE(!commit);
- REQUIRE((args::get(pathsList) == std::vector<std::string>{"B", "C", "D"}));
- REQUIRE(args::get(gitdir) == "A");
+ REQUIRE((*pathsList == std::vector<std::string>{"B", "C", "D"}));
+ REQUIRE(*gitdir == "A");
}
TEST_CASE("Subparser commands work as expected", "[args]")
@@ -775,7 +775,7 @@ TEST_CASE("Subparser commands work as expected", "[args]")
REQUIRE(add);
REQUIRE(!commit);
REQUIRE((paths == std::vector<std::string>{"B", "C", "D"}));
- REQUIRE(args::get(gitdir) == "A");
+ REQUIRE(*gitdir == "A");
}
TEST_CASE("Subparser commands with kick-out flags work as expected", "[args]")
@@ -1196,16 +1196,16 @@ TEST_CASE("ValueParser works as expected", "[args]")
args::PositionalList<double> ds(p, "name", "description");
REQUIRE_NOTHROW(p.ParseArgs(std::vector<std::string>{"-f", "a b"}));
- REQUIRE(args::get(f) == "a b");
+ REQUIRE(*f == "a b");
REQUIRE_NOTHROW(p.ParseArgs(std::vector<std::string>{"-b", "a b"}));
- REQUIRE(args::get(b).path == "a b");
+ REQUIRE(b->path == "a b");
REQUIRE_NOTHROW(p.ParseArgs(std::vector<std::string>{"-i", "42 "}));
- REQUIRE(args::get(i) == 42);
+ REQUIRE(*i == 42);
REQUIRE_NOTHROW(p.ParseArgs(std::vector<std::string>{"-i", " 12"}));
- REQUIRE(args::get(i) == 12);
+ REQUIRE(*i == 12);
REQUIRE_THROWS_AS(p.ParseArgs(std::vector<std::string>{"-i", "a"}), args::ParseError);
REQUIRE_THROWS_AS(p.ParseArgs(std::vector<std::string>{"-d", "b"}), args::ParseError);
@@ -1431,7 +1431,7 @@ TEST_CASE("Required flags work as expected in noexcept mode", "[args]")
argstest::ValueFlag<int> bar(parser1, "bar", "bar", {'b', "bar"});
parser1.ParseArgs(std::vector<std::string>{"-f", "42"});
- REQUIRE(foo.Get() == 42);
+ REQUIRE(*foo == 42);
REQUIRE(parser1.GetError() == argstest::Error::None);
parser1.ParseArgs(std::vector<std::string>{"-b4"});
View it on GitLab: https://salsa.debian.org/med-team/libargs/-/compare/80bead49ab02c2dc07d56290fdf7af140552210d...23a4d6112e00c0b404a28404e77f2364cc2cfa1a
--
View it on GitLab: https://salsa.debian.org/med-team/libargs/-/compare/80bead49ab02c2dc07d56290fdf7af140552210d...23a4d6112e00c0b404a28404e77f2364cc2cfa1a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220413/e83b4529/attachment-0001.htm>
More information about the debian-med-commit
mailing list