@@ -24,15 +24,15 @@ #include #include #include - u8 entry(kenv e) { + stat entry(kenv e) { kcli_flag aardvark; kcli_flag zebra; char* user; char* password; long age; - kcli_param* params = { + kcli_param params[] = { { "user", kcli_param_string, kcli_class_required, &user, "the user to log in as" } // or Kcli_param(user,string,required,"the user to log in as"), @@ -39,9 +39,9 @@ { "age", kcli_param_dec, kcli_class_optional, &age, "the age of the user" } // or Kcli_param(age,dec,optional,"the age of the user"), }; - kcli_opt* options = { + kcli_opt options[] = { { 'a', "aardvark", kcli_opt_flag, &aardvark, "a nocturnal burrowing mammal" }, // or Kcli_opt(aardvark, 'a', flag, "a nocturnal burrowing mammal") { 'z', "zebra", kcli_opt_flag, &zebra, @@ -48,15 +48,15 @@ "a striped equine" }, { 'p', "password", kcli_opt_string, &password, "the password to log in with" } }; - kcli_set me = { + kcli_set argset = { "demo", e.argc, e.argv, "a demonstration of the kcli_set type", params, Kmsz(params), options, Kmsz(options) }, - size_t args_parsed = kcli_parse(&me); + size_t args_parsed = kcli_parse(&argset); if (args_parsed == 0) { kcli_usage(&me, e.err); return 1; } return 0; } @@ -79,8 +79,9 @@ * `kcli_opt_hex` - flag tells kcli to add a hexdecimal number to the list of expected parameters * `kcli_opt_flag` - flag is an option: will return `kcli_flag_on` if entered at least once, `kcli_flag_off` otherwise. * `kcli_opt_toggle` - flag toggles value on and off: will return `kcli_flag_on` if entered an odd number of times, `kcli_flag_off` otherwise. * `kcli_opt_accumulate` - flag increments a value every time it is entered; often used to implement `-v (--verbose)`-style options (e.g. `-vvvv` would return a value of `4`). + * `kcli_opt_enum` - flag is one of a series of enumerated values, which will be matched against a table to yield the associated integer. ### struct kcli_param `kcli_param` describes a parameter that may be passed to the program whether or not any flags are passed.