[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
グループオプションも可能です.グループに所属するオプションは,
お互いに排他的であると考慮されます.この機能を使用するために,最
初にgroup
を定義する必要があり,その後でgroupoption
を定義
することが可能になります.グループオプションは,基本的に標準的なオプショ
ンの構文と同じですが,必須フラグを指定してはならず(同じグループのオプショ
ンは,お互いに排他的なので,意味が無いでしょう),オプションが所属するグ
ループを指定する必要があります.
defgroup "<group name>" {groupdesc="<group description>"} {yes} groupoption <long> <short> <desc> <argtype> group="<group name>" \ {argoptional} {multiple} |
グループが必須として定義されている場合,グループに所属している一つの(そ して,一つだけ)オプションを指定する必要があります.
以下は例です(テスト`test_group_cmd.ggo'から持ってきました).
defgroup "my grp2" defgroup "grp1" groupdesc="an option of this group is required" yes groupoption "opta" a "string a" group="grp1" multiple groupoption "optA" A "string A" string group="grp1" argoptional groupoption "optAmul" M "string M" string group="grp1" argoptional multiple groupoption "optb" b "string b" group="grp1" groupoption "optc" - "string c" group="my grp2" groupoption "optd" d "string d" group="my grp2" |
グループgrp1
は必須で,--opta
または--optb
を指定する
必要があります(そしてそれは,どちらか一方だけです).以下は何度か実行し
た結果です.
$ ./test_groups test_groups: 0 options of group grp1 were given. One is required $ ./test_groups -a OK $ ./test_groups -a -a OK (the same option given twice) $ ./test_groups -a -b test_groups: 2 options of group grp1 were given. One is required $ ./test_groups -a -c OK $ ./test_groups -a --optc -d test_groups: 2 options of group my grp2 were given. At most one is required |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Akihiro Sagawa on November, 2 2005 using texi2html 1.70.