mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
This has been bounced around for a couple years now #474 and a few others have expressed desire to work with non-standard option names. We have been somewhat resistant to that but I think it can be done now. This PR adds a modifier `allow_non_standard_option_names()` It is purposely long, it is purposely off by default. But what it does is allow option names with a single `-` to act like a short option name. With this modifier enabled no single letter short option names are allowed to start with the same letter as a non-standard names. For example `-s` and `-single` would not be allowed. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
37 lines
754 B
C++
37 lines
754 B
C++
// Copyright (c) 2017-2024, University of Cincinnati, developed by Henry Schreiner
|
|
// under NSF AWARD 1414736 and by the respective contributors.
|
|
// All rights reserved.
|
|
//
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#ifdef CLI11_SINGLE_FILE
|
|
#include "CLI11.hpp"
|
|
#else
|
|
#include "CLI/CLI.hpp"
|
|
#endif
|
|
|
|
#include "catch.hpp"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using input_t = std::vector<std::string>;
|
|
|
|
TEST_CASE("Basic: Empty", "[simple]") {
|
|
|
|
{
|
|
CLI::App app;
|
|
input_t simpleput;
|
|
app.parse(simpleput);
|
|
}
|
|
{
|
|
CLI::App app;
|
|
input_t spare = {"spare"};
|
|
CHECK_THROWS_AS(app.parse(spare), CLI::ExtrasError);
|
|
}
|
|
{
|
|
CLI::App app;
|
|
input_t simpleput;
|
|
app.parse(simpleput);
|
|
}
|
|
}
|