How to make CLI to prompt for user to input values (multiple of them) that correspond to multiple parameters, Below is an example:
tailf:action my_cli {
description “my cli”;
tailf:info “my cli”;
tailf:actionpoint my_cli_action;
input {
leaf input_1 {
type string;
description “my input 1”;
tailf:info “my input 1”;
}
leaf input_2 {
type string;
description “my input 2”;
tailf:info “my input 2”;
}
leaf input_3 {
type string;
description “my input 3”;
tailf:info “my input 3”;
}
}
output {
}
}
Below is how if user enters the values for the parameters in a single line:
$my_cli input_1 <value_1> input_2 <value_2> input_3 <value_3>
Alternatively, the user also should be able enter value in prompt.
For example, if user enter just the following and press enter, then it will prompt for user to enter value for “input_1”. The problem is that it works one argument and not for all. and execute the action with just “my_input_1”. Note that none of the parameters here are mandatory.
$my_cli input_1
value for my_input_1:
So, given this situation, how to make the CLI to prompt the user to input values for all parameters one after the other before it executes the CLI command.