Skip to content

seqan/sharg-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ef588dd · Dec 6, 2024
Dec 6, 2024
Feb 7, 2024
Feb 9, 2024
Sep 23, 2024
Sep 20, 2024
Aug 28, 2024
Dec 6, 2024
Feb 7, 2024
Feb 7, 2024
Dec 6, 2024
Feb 7, 2024
Feb 7, 2024
Feb 7, 2024
Feb 8, 2024
Feb 7, 2024
Feb 8, 2024
Feb 8, 2024
Feb 7, 2024
Aug 19, 2024

Repository files navigation

sharg_logo Sharg -- hungrily eating away your arguments

build status codecov license platforms twitter

The Sharg parser offers a neat and easy-to-use header-only library for argument parsing in C++. With Sharg, your command line interface can be customized to your specific needs and validated in a single line. Furthermore, the library provides helpful templates and makes even subcommands feel effortless. For more information, details, and a tutorial on how to use our features, please see our online documentation.

If you are working in the field of sequence analysis, we recommend using the SeqAn3 library, which offers a wide range of bioinformatics-related C++ features.

Sneak Peek:

An application with one option parsing an integer from the command line can be written in only 5 lines of code:

#include <sharg/all.hpp>

int main(int argc, char ** argv)
{
    int val{};

    sharg::parser parser{"Eat-Me-App", argc, argv};
    parser.add_subsection("Eating Numbers");
    parser.add_option(val, sharg::config{.short_id = 'i', .long_id = "int", .description = "Desc."});
    parser.parse();

    return 0;
}

Done. val is automatically filled with the value provided by -i or --int.

You also have a pretty help page and many more features:

user$ ./Eat-Me-App -h
Eat-Me-App
==========

OPTIONS

  Eating Numbers
    -i, --int (signed 32 bit integer)
          Desc. Default: 0

  Common options
    -h, --help
          Prints the help page.
    -hh, --advanced-help
          Prints the help page including advanced options.
    --version
          Prints the version information.
    --copyright
          Prints the copyright/license information.
    --export-help (std::string)
          Export the help page information. Value must be one of [html, man,
          ctd, cwl].
    --version-check (bool)
          Whether to check for the newest app version. Default: true

VERSION
    Last update:
    Eat-Me-App version:
    Sharg version: 1.1.2-rc.1

Dependencies

requirement version comment
compiler GCC ≥ 11
compiler Clang ≥ 17
build system CMake ≥ 3.16 optional, but recommended
optional libs TDL ≥ 1.0.0 required for CWL and CTD export