p-ranav / argparse

Argument Parser for Modern C++
MIT License
2.59k stars 244 forks source link

Add a ArgumentParser::add_hidden_alias_for() method #330

Closed rouault closed 5 months ago

rouault commented 5 months ago

It is sometimes desirable to offer an alias for an argument, but without it appearing it in the usage. For example, to phase out a deprecated wording of an argument while not breaking backwards compatible. This can be done with the `ArgumentParser::add_hidden_alias_for() method.

argparse::ArgumentParser program("test");

auto &arg = program.add_argument("--suppress").flag();
program.add_hidden_alias_for(arg, "--supress"); // old misspelled alias