ArgParser

A library for parsing arguments with support for command-like input.

Introduction

ArgParser originated as a testing project for Tram and was subsequently released as a header-only C++17 library, licensed under the MIT license. Its purpose is to efficiently parse command-line arguments. It has a minimal code base and no external dependencies, and it offers features such as automatic help page generation, terminal color support, and compatibility across all modern compilers.

Examples

TODO
psap::ArgParser parser{
    psap::ParserConf{
        "project_name", 4, true, true, psap::ValueStyle::Both, psap::UnknownOptionPolicy::ReportRemove}};

auto HELP_ACTION = 
    [](const psap::ArgParser &parser, const psap::Command &cmd)
    {
        parser(parser[0]);
    }

parser.command("help", "h")
    .help("Shows help.")
    .action(HELP_ACTION);

parser.parse(argv, argc);

Example 1: Sample code for the 'help' command, which prints the help page when called.

TODO
psap::ArgParser parser{
        psap::ParserConf{"project_name", 4, true, true, psap::ValueStyle::Both, psap::UnknownOptionPolicy::ReportRemove}};

auto RUN_ACTION = 
    [](const psap::ArgParser &parser, const psap::Command &cmd)
    {
        //Run action...
    }

parser.command("run", "r")
    .help("Runs something.")
    .option(psap::make_value("--target", "-t", "Select a Target."))
    .option(psap::make_flag("--debug", "-d", "Runs in debug."))
    .action(RUN_ACTION);

parser.parse(argv, argc);

Example 2: Sample code for the 'run' command with a flag and value configured.

In depth

TODO