@@ -72,14 +72,26 @@ static int parse_opt(int key, char* arg, struct argp_state* state) {
7272 printf ("count: %s\n" , arg );
7373 }
7474 break ;
75- case 1000 : {
75+ case 'l' : {
7676 printf ("low: %s\n" , arg );
7777 }
7878 break ;
79- case 1001 : {
79+ case 'h' : {
8080 printf ("high: %s\n" , arg );
8181 }
8282 break ;
83+ case 'd' : {
84+ printf ("deterministic: %s\n" , arg );
85+ }
86+ break ;
87+ case 'g' : {
88+ printf ("group: %s\n" , arg );
89+ }
90+ break ;
91+ case 't' : {
92+ printf ("group-threshold: %s\n" , arg );
93+ }
94+ break ;
8395 case ARGP_KEY_INIT : {
8496 printf ("INIT\n" );
8597 }
@@ -97,24 +109,28 @@ static int parse_opt(int key, char* arg, struct argp_state* state) {
97109}
98110
99111struct argp_option options [] = {
100- {"in" , 'i' , "[random|hex|bits|cards|dice|base6|base10|ints|bip39|slip39]" , 0 , "Specify the input format (default: random)" },
101- {"out" , 'o' , "[hex|bits|cards|dice|base6|base10|ints|bip39|slip39]" , 0 , "Specify the output format (default: hex)." },
102- {"count" , 'c' , "N" , 0 , "Specify the count of output units (default: 32)" },
112+ {"in" , 'i' , "[random|hex|bits|cards|dice|base6|base10|ints|bip39|slip39]" , 0 , "The input format (default: random)" },
113+ {"out" , 'o' , "[hex|bits|cards|dice|base6|base10|ints|bip39|slip39]" , 0 , "The output format (default: hex)" },
114+ {"count" , 'c' , "N" , 0 , "The number of output units (default: 32)" },
115+ {0 , 0 , 0 , 0 , "Deterministic Random Numbers:" , 8 },
103116 {"deterministic" , 'd' , "SEED" , 0 , "Use a deterministic random number generator with SEED" },
104117 {0 , 0 , 0 , 0 , "ints Input and Output Options:" , 7 },
105- {"low" , 1000 , "LOW" , 0 , "The lowest int returned (default: 1)" },
106- {"high" , 1001 , "HIGH" , 0 , "The highest int returned (default: 9)" },
118+ {"low" , 'l' , "LOW" , 0 , "The lowest int returned (default: 1)" },
119+ {"high" , 'h' , "HIGH" , 0 , "The highest int returned (default: 9)" },
120+ {"0 <= low < high <= 255" , 0 , 0 , OPTION_DOC , 0 },
107121 {0 , 0 , 0 , 0 , "SLIP39 Output Options:" , 6 },
108- {"group-threshold" , 1002 , "N" , 0 , "The number of groups that must contribute (default: 1)" },
109- {"group" , 1003 , "N-of-M" , 0 , "The group specification (default: 1-of-1)" },
122+ {"group-threshold" , 'g' , "G" , 0 , "The number of groups that must contribute (default: 1)" },
123+ {"group" , 't' , "N-of-M" , 0 , "The group specification (default: 1-of-1)" },
124+ {"The --group option may appear more than once." , 0 , 0 , OPTION_DOC , 0 },
125+ {"The group threshold G must be <= the number of group specifications." , 0 , 0 , OPTION_DOC , 0 },
110126 { 0 }
111127};
112128
113129const char * argp_program_version = "version 1.0" ;
114130const char * argp_program_bug_address = "[email protected] " ;
115131
116132char doc [] = "Converts cryptographic seeds between various forms." ;
117- struct argp argp = { options , parse_opt , "WORD [WORD [WORD [WORD]]] " , doc };
133+ struct argp argp = { options , parse_opt , "INPUT " , doc };
118134
119135params * parse_params ( int argc , char * argv [] ) {
120136 params * p = new_params ();
0 commit comments