mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-01-16 07:08:01 +00:00
Compare commits
4 Commits
611431ceb0
...
5925f94b69
Author | SHA1 | Date | |
---|---|---|---|
|
5925f94b69 | ||
|
f80a69de3b | ||
|
3bea1de2d5 | ||
|
5c35c182f6 |
@ -359,6 +359,15 @@
|
||||
"contributions": [
|
||||
"platform"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "certik",
|
||||
"name": "Ondřej Čertík",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/20568?v=4",
|
||||
"profile": "https://ondrejcertik.com/",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
30
CHANGELOG.md
30
CHANGELOG.md
@ -1,3 +1,33 @@
|
||||
## Version 2.0: In progress
|
||||
|
||||
* Built-in config format is TOML compliant now [#435]
|
||||
* Config updates [#442]
|
||||
* More powerful containers, `%%` separator [#423]
|
||||
* Add a version flag easily [#452]
|
||||
|
||||
[#435]: https://github.com/CLIUtils/CLI11/pull/435
|
||||
[#443]: https://github.com/CLIUtils/CLI11/pull/443
|
||||
[#423]: https://github.com/CLIUtils/CLI11/pull/423
|
||||
[#452]: https://github.com/CLIUtils/CLI11/pull/452
|
||||
|
||||
|
||||
### Version 1.9.1: Backporting fixes
|
||||
|
||||
This is a patch version that backports fixes from the development of 2.0.
|
||||
|
||||
* Fix an issue with string conversion [#421][]
|
||||
* Cross-compiling improvement for Conan.io [#430][]
|
||||
* Fix option group default propagation [#450][]
|
||||
* Fix for C++20 [#459][]
|
||||
* Support compiling with RTTI off [#461][]
|
||||
|
||||
[#421]: https://github.com/CLIUtils/CLI11/pull/421
|
||||
[#430]: https://github.com/CLIUtils/CLI11/pull/430
|
||||
[#450]: https://github.com/CLIUtils/CLI11/pull/450
|
||||
[#459]: https://github.com/CLIUtils/CLI11/pull/459
|
||||
[#461]: https://github.com/CLIUtils/CLI11/pull/461
|
||||
|
||||
|
||||
## Version 1.9: Config files and cleanup
|
||||
|
||||
Config file handling was revamped to fix common issues, and now supports reading [TOML](https://github.com/toml-lang/toml).
|
||||
|
@ -926,6 +926,7 @@ This project was created by [Henry Schreiner](https://github.com/henryiii) and m
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/jsoref"><img src="https://avatars0.githubusercontent.com/u/2119212?v=4" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="#tool-jsoref" title="Tools">🔧</a></td>
|
||||
<td align="center"><a href="https://github.com/geir-t"><img src="https://avatars3.githubusercontent.com/u/35292136?v=4" width="100px;" alt=""/><br /><sub><b>geir-t</b></sub></a><br /><a href="#platform-geir-t" title="Packaging/porting to new platform">📦</a></td>
|
||||
<td align="center"><a href="https://ondrejcertik.com/"><img src="https://avatars3.githubusercontent.com/u/20568?v=4" width="100px;" alt=""/><br /><sub><b>Ondřej Čertík</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Acertik" title="Bug reports">🐛</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -945,7 +946,7 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi
|
||||
[doi-badge]: https://zenodo.org/badge/80064252.svg
|
||||
[doi-link]: https://zenodo.org/badge/latestdoi/80064252
|
||||
[azure-badge]: https://dev.azure.com/CLIUtils/CLI11/_apis/build/status/CLIUtils.CLI11?branchName=master
|
||||
[azure]: https://dev.azure.com/CLIUtils/CLI11/_build/latest?definitionId=1&branchName=master
|
||||
[azure]: https://dev.azure.com/CLIUtils/CLI11
|
||||
[travis-badge]: https://img.shields.io/travis/CLIUtils/CLI11/master.svg?label=Linux/macOS
|
||||
[travis]: https://travis-ci.org/CLIUtils/CLI11
|
||||
[appveyor-badge]: https://img.shields.io/appveyor/ci/HenrySchreiner/cli11/master.svg?label=AppVeyor
|
||||
|
@ -5,9 +5,11 @@
|
||||
|
||||
trigger:
|
||||
- master
|
||||
- 'v*'
|
||||
|
||||
pr:
|
||||
- master
|
||||
- 'v*'
|
||||
|
||||
variables:
|
||||
cli11.single: ON
|
||||
@ -63,7 +65,11 @@ jobs:
|
||||
Windowslatest:
|
||||
vmImage: 'windows-2019'
|
||||
cli11.std: 20
|
||||
cli11.options: -DCMAKE_CXX_FLAG="/std:c++latest"
|
||||
cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc"
|
||||
Linux17nortti:
|
||||
vmImage: 'ubuntu-latest'
|
||||
cli11.std: 17
|
||||
cli11.options: -DCMAKE_CXX_FLAGS="-fno-rtti"
|
||||
pool:
|
||||
vmImage: $(vmImage)
|
||||
steps:
|
||||
|
@ -135,7 +135,7 @@ The default configuration file will read INI files, but will write out files in
|
||||
```cpp
|
||||
app.config_formatter(std::make_shared<CLI::ConfigINI>());
|
||||
```
|
||||
which makes use of a predefined modification of the ConfigBase class which TOML also uses. If a custom formatter is used that is not inheriting from the from ConfigBase class `get_config_formatter_base() will return a nullptr, so some care must be exercised in its us with custom configurations.
|
||||
which makes use of a predefined modification of the ConfigBase class which TOML also uses. If a custom formatter is used that is not inheriting from the from ConfigBase class `get_config_formatter_base() will return a nullptr if RTTI is on (usually the default), or garbage if RTTI is off, so some care must be exercised in its use with custom configurations.
|
||||
|
||||
## Custom formats
|
||||
|
||||
|
@ -1374,20 +1374,20 @@ class App {
|
||||
int exit(const Error &e, std::ostream &out = std::cout, std::ostream &err = std::cerr) const {
|
||||
|
||||
/// Avoid printing anything if this is a CLI::RuntimeError
|
||||
if(dynamic_cast<const CLI::RuntimeError *>(&e) != nullptr)
|
||||
if(e.get_name() == "RuntimeError")
|
||||
return e.get_exit_code();
|
||||
|
||||
if(dynamic_cast<const CLI::CallForHelp *>(&e) != nullptr) {
|
||||
if(e.get_name() == "CallForHelp") {
|
||||
out << help();
|
||||
return e.get_exit_code();
|
||||
}
|
||||
|
||||
if(dynamic_cast<const CLI::CallForAllHelp *>(&e) != nullptr) {
|
||||
if(e.get_name() == "CallForAllHelp") {
|
||||
out << help("", AppFormatMode::All);
|
||||
return e.get_exit_code();
|
||||
}
|
||||
|
||||
if(dynamic_cast<const CLI::CallForVersion *>(&e) != nullptr) {
|
||||
if(e.get_name() == "CallForVersion") {
|
||||
out << e.what() << std::endl;
|
||||
return e.get_exit_code();
|
||||
}
|
||||
@ -1606,7 +1606,12 @@ class App {
|
||||
|
||||
/// Access the config formatter as a configBase pointer
|
||||
std::shared_ptr<ConfigBase> get_config_formatter_base() const {
|
||||
// This is safer as a dynamic_cast if we have RTTI, as Config -> ConfigBase
|
||||
#if defined(__cpp_rtti) || (defined(__GXX_RTTI) && __GXX_RTTI) || (defined(_HAS_STATIC_RTTI) && (_HAS_STATIC_RTTI == 0))
|
||||
return std::dynamic_pointer_cast<ConfigBase>(config_formatter_);
|
||||
#else
|
||||
return std::static_pointer_cast<ConfigBase>(config_formatter_);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Get the app or subcommand description
|
||||
|
@ -508,7 +508,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
/// Can find a string if needed
|
||||
template <typename T = App> Option *needs(std::string opt_name) {
|
||||
auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
auto opt = static_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
if(opt == nullptr) {
|
||||
throw IncorrectConstruction::MissingOption(opt_name);
|
||||
}
|
||||
@ -550,7 +550,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
/// Can find a string if needed
|
||||
template <typename T = App> Option *excludes(std::string opt_name) {
|
||||
auto opt = dynamic_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
auto opt = static_cast<T *>(parent_)->get_option_no_throw(opt_name);
|
||||
if(opt == nullptr) {
|
||||
throw IncorrectConstruction::MissingOption(opt_name);
|
||||
}
|
||||
@ -587,7 +587,7 @@ class Option : public OptionBase<Option> {
|
||||
template <typename T = App> Option *ignore_case(bool value = true) {
|
||||
if(!ignore_case_ && value) {
|
||||
ignore_case_ = value;
|
||||
auto *parent = dynamic_cast<T *>(parent_);
|
||||
auto *parent = static_cast<T *>(parent_);
|
||||
for(const Option_p &opt : parent->options_) {
|
||||
if(opt.get() == this) {
|
||||
continue;
|
||||
@ -612,7 +612,7 @@ class Option : public OptionBase<Option> {
|
||||
|
||||
if(!ignore_underscore_ && value) {
|
||||
ignore_underscore_ = value;
|
||||
auto *parent = dynamic_cast<T *>(parent_);
|
||||
auto *parent = static_cast<T *>(parent_);
|
||||
for(const Option_p &opt : parent->options_) {
|
||||
if(opt.get() == this) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user