sharg 1.0.0
THE argument parser for bio-c++ tools.
Changelog

This changelog contains a top-level entry for each release with sections on new features, API changes and notable bug-fixes (not all bug-fixes will be listed).

See the Sharg documentation on API stability to learn about when API changes are allowed in the Sharg-parser.

Release 1.0.0

We are happy to release the first version of the SeqAn Sharg parser!

The Sharg parser succeeds the former seqan3::argument_parser with a few new features in a light-weight repository. Most notably, we switched to Designated initializers for configuring (positional) options and flags when adding them to the parser. See API changes for more details.

From this release on, most of the API is now stable. Stable entities are marked as such in our online documentation.

New features

Besides the new sharg::config API using designated initializers, which is described in API changes, you can now alter the default message printed on the help page. E.g.

int i{0};
parser.add_option(val, sharg::config{.short_id = 'i', .default_message = "Calculated from your data"});
Option struct that is passed to the sharg::parser::add_option() function.
Definition: config.hpp:46
char short_id
The short identifier for the option (e.g. 'a', making the option callable via -a).
Definition: config.hpp:56

prints

-i (signed 32 bit integer)
Default: Calculated from your data.

instead of Default: 0.. See our online documentation for more details.

API changes

Name changes

If you are switching form the seqan3::argument_parser to the sharg::parser there are several name changes. All of them can be fixed with a simple search & replace:

  • The namespace of all entities is now sharg instead of seqan3
  • Every occurrence of argument_parser has been replaced with parser
  • The concept seqan::parser_compatible_option has been renamed to sharg::parsable

add_option/add_flag/add_positional_option

!Important! New API of add_option()/add_flag()/add_positional_option() calls that is more descriptive and flexible. An option flag or positional option is added with only two parameters: (1) Its value that stores the command line parameter (nothing changed here) (2) A sharg::config object (NEW)

Before:

parser.add_option(val, 'i', "int", "some int");

Now:

parser.add_option(val, sharg::config{.short_id = 'i', .long_id = "int", .description = "some int"});

We take advantage of Designated initializers that make the call much more descriptive and flexible. E.g., you can leave out parameters you don't need, but beware that the order must be as specified in sharg::config.

You can now set an option as required without the need of the sharg::option_spec

parser.add_option(val, sharg::config{.short_id = 'i', .required = true});

!Important! We removed the sharg::option_spec as it is obsolete in the new API.

Concepts

Validators