Taywee /
args
A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).
Loading repository data…
bfgroup / repository
A simple to use, composable, command line parser for C++ 11 and beyond
= Lyra
// tag::intro[]
[.tagline] A simple to use, composing, header only, command line arguments parser for C++ 11 and beyond.
[horizontal.shields] Obtain:: image:https://img.shields.io/github/downloads/bfgroup/Lyra/total.svg?label=GitHub[GitHub All Releases, link="https://github.com/bfgroup/Lyra/releases"] image:https://img.shields.io/badge/package-Conan-blue[Conan Center, link="https://conan.io/center/lyra"] License:: image:https://img.shields.io/badge/license-BSL%201.0-blue.svg["Boost Software License 1.0", link="LICENSE.txt"] Standards:: image:https://img.shields.io/badge/standard-C%2B%2B%2011-blue.svg?logo=C%2B%2B["C\+\+ 11", link="https://isocpp.org/"] image:https://img.shields.io/badge/standard-C%2B%2B%2014-blue.svg?logo=C%2B%2B["C\+\+ 14", link="https://isocpp.org/"] image:https://img.shields.io/badge/standard-C%2B%2B%2017-blue.svg?logo=C%2B%2B["C\+\+ 17", link="https://isocpp.org/"] image:https://img.shields.io/badge/standard-C%2B%2B%2020-blue.svg?logo=C%2B%2B["C\+\+ 20", link="https://isocpp.org/"] image:https://img.shields.io/badge/standard-C%2B%2B%2023-blue.svg?logo=C%2B%2B["C\+\+ 23", link="https://isocpp.org/"] Stats:: image:https://img.shields.io/github/languages/code-size/bfgroup/Lyra.svg[GitHub code size in bytes, link="https://github.com/bfgroup/Lyra"] image:https://img.shields.io/github/issues/bfgroup/Lyra.svg[GitHub issues, link="https://github.com/bfgroup/Lyra/issues"] image:https://img.shields.io/github/stars/bfgroup/Lyra.svg?label=%E2%98%85[GitHub stars, link="https://github.com/bfgroup/Lyra/stargazers"] Tests:: image:https://img.shields.io/azure-devops/build/bfgroup/6b664745-b518-4d13-8e46-807d74231e73/2/release?label=release&logo=azuredevops["Azure DevOps", link="https://dev.azure.com/bfgroup/Lyra"] image:https://img.shields.io/azure-devops/build/bfgroup/6b664745-b518-4d13-8e46-807d74231e73/2/develop?label=develop&logo=azuredevops["Azure DevOps", link="https://dev.azure.com/bfgroup/Lyra"] image:https://img.shields.io/appveyor/build/bfgroup/lyra/release?label=release&logo=appveyor["AppVeyor", link="https://ci.appveyor.com/project/bfgroup/lyra"] image:https://img.shields.io/appveyor/build/bfgroup/lyra/develop?label=develop&logo=appveyor["AppVeyor", link="https://ci.appveyor.com/project/bfgroup/lyra"]
// end::intro[]
== License
// tag::license[]
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// end::license[]
== Features
// tag::features[]
std library).opt or arg is an independent parser. Combine these to
produce a composite parser -- this can be done in stages across multiple
function calls -- or even projects.ostream <<), with error handling, behind the scenes.arg-s from one to many.// end::features[]
== Using
// tag::using[]
To use, just #include <lyra/lyra.hpp>
A parser for a single option can be created like this:
You can use this parser directly like this:
auto result = cli.parse( { argc, argv } ); if ( !result ) { std::cerr << "Error in command line: " << result.message() << std::endl; exit(1); }
Note that exceptions are not used for error handling.
You can combine parsers by composing with |, like this:
opt specifies options that start with a short dash (-) or long dash (--).
Options can be argument taking (such as -w 42), in which case
the opt takes a second argument -- a hint, or they are pure flags (such as
-d), in which case the opt has only one argument -- which must be a boolean.
The option names are provided in one or more sets of square brackets, and a
description string can be provided in parentheses. The first argument to an
opt is any variable, local, global member, of any type that can be converted
from a string using std::ostream.
arg specifies arguments that are not tied to options, and so have no square
bracket names. They otherwise work just like opt.
A usage string can be obtained by inserting the parser into a stream. The usage string is built from the information supplied.
As a convenience, the standard help options (-h, --help and -?) can be
specified using the help parser, which just takes a boolean to bind to.
// end::using[]
== More
There is a single-header version that is generated from the source files.
You can find it at data/single_include/lyra/lyra.hpp. Some caveats for it:
For more information and documentation see the link:https://bfgroup.github.io/Lyra/[web site].
Selected from shared topics, language and repository description—not editorial ratings.
Taywee /
A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).
DAarno /
This is a simple templatized C++ library for parsing command line arguments. The library provides a simple, flexible object-oriented interface to the command line that automates argument parsing, USAGE creation and type casting.
tascvh /
SimpleCmdParser is a minimalistic easy to use command line argument parser for modern C++ applications.
LeandreBl /
A simple C argument parser and handler to replace using getopt and getoptlong
diridari /
Easy to use C++ argument parsing library. It intends to be easy to use and gain a good user experience by generating help messages, bash auto completion and by providing a simple to use api. For each argument it is possible to register a callback function or a lambda expressions, which gets invoked if the corresponding argument gets parsed.
A very simple c# command line arguments Parser, include the nuget package, add to your program and you are done...