Closed filka55533 closed 1 week ago
Ivan, There are a 3 missing pieces I think, just by going with what you have above. Two of them are 'optional'.
1) The required callback . The callback routine can use the cli_get_optarg_value() call to find out what the user actually entered - for example user_val = cli_get_optarg_value(cli, "port_type_list", NULL); This will return a char* to the string entered by the user. You'll have to convert to a number yourself.
2) An optional 'completor' function. This is a routine you need to write that can return a selection of possible values, base on what the user actually entered. For instance, if your values are 1 to 15, and the user enters '1', then possible values are 1, 10, 11,12,13,14, and 15.
3) An optional 'validator' function. This is a routine you would write that ensures that the user entered value is actually valid. You'll get passed the string and have to convert to an integer yourself.
Look at the 'clitest.c' program in the source code. It doesn't have an callback along the lines of what you are doing, but it does show the completor/validator/callback for the 'color' or 'shape' optargs on the 'perimeter' command.
Hello, i have no idea how to create configure function, for example selection
interface FastEthernet
where available argument is number from number list. Next example:Thank you in advance