boostorg / boostorg/program_options
Supplying a list of possible values instead of a default value to an option?
- Langage dominant
- C++
- Étoiles
- 136
- Forks
- 117
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Is there a way to specify a restricted list of values a command line option can take? I was thinking of something like this:
```
#include
namespace po = boost::program_options;
po::options_description description("General options");
description.add_options()
("key", po::value()->possible_values("a", "b", "c"), "description of key");
```
Running `executable --key d` in the command line would throw an error but `executable --key a` would not. I know there is the option of manually processing the argument supplied to the key later on, but I was wondering if the functionality of identifying unambiguous abbreviations could be utilised.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par retracer la manière dont boost/program_options gère po::value() et la validation des valeurs de la ligne de commande, puis examinez où sont implémentées les abréviations d’options non ambiguës. Le travail est terminé lorsqu’une option peut déclarer les valeurs "a", "b" et "c", rejeter "d", accepter les valeurs valides et conserver le comportement pertinent des abréviations.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp
- Domaine
- cli
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100