Skip to content

Latest commit

 

History

History
169 lines (142 loc) · 7.43 KB

README.md

File metadata and controls

169 lines (142 loc) · 7.43 KB

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