boostorg / boostorg/program_options
Supplying a list of possible values instead of a default value to an option?
- 主要言語
- C++
- スター
- 136
- フォーク
- 117
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、boost/program_options が po::value() とコマンドライン値の検証をどのように処理しているかを追跡し、次に、曖昧さのないオプション省略形がどこで実装されているかを調べます。あるオプションで値 "a"、"b"、"c" を宣言し、"d" を拒否し、有効な値を受け入れ、関連する省略形の動作を維持できるようになれば、作業は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- cli
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100