libk  Diff

Differences From Artifact [a50dc5f1ed]:

To Artifact [5126e2cc55]:


     5      5   #include <k/io.h>
     6      6   #include <k/type.h>
     7      7   #include <k/internal.egroup.h>
     8      8   
     9      9   /* input types */
    10     10   
    11     11   typedef struct kcli_opt {
    12         -	codepoint id;
           12  +	rune id;
    13     13   	const char* name;
    14     14   	enum kcli_opt_kind {
    15     15   		kcli_opt_none /* flag is disabled and hidden */,
    16     16   		kcli_opt_string /* flag takes a string argument */,
    17     17   		kcli_opt_flag /* on if present, off if absent */,
    18     18   		kcli_opt_toggle /* off by default, value toggles
    19     19   		                 * for each occurrence */,
................................................................................
    46     46   		kcli_param_int = 0x40,
    47     47   			kcli_param_oct = kcli_param_int | 8,
    48     48   			kcli_param_dec = kcli_param_int | 10,
    49     49   			kcli_param_hex = kcli_param_int | 16,
    50     50   	} kind;
    51     51   	enum kcli_rule {
    52     52   		kcli_rule_forbidden,
    53         -		kcli_rule_optional,
    54     53   		kcli_rule_required,
           54  +		kcli_rule_optional,
           55  +		kcli_rule_overflow,
    55     56   	} rule;
           57  +	void* val;
           58  +	const char* desc;
    56     59   } kcli_param;
    57     60   
    58     61   typedef struct kcli_set {
    59     62   	const char*       name;
    60     63   	const char*       version;
    61     64   	const char**      args;   sz argc;
    62     65   	const char*       desc;
................................................................................
    68     71   
    69     72   typedef enum kcli_cond {
    70     73   	kcli_cond_ok = kcli_cond_id,
    71     74   	kcli_cond_extra /* parse succeded, but arguments or
    72     75   	                   flags were left over */,
    73     76   	kcli_cond_fail /* unspecified error */,
    74     77   	kcli_cond_parse /* bad syntax, parse failed */,
           78  +	kcli_cond_overlong /* a string in the configuration structures is longer than allowed */,
    75     79   } kcli_cond;
    76     80   
    77     81   typedef enum kcli_flag {
    78     82   	kcli_flag_off = 0,
    79     83   	kcli_flag_on = 1,
    80     84   } kcli_flag;
    81     85