hi NeraPhil,
Just as a recap, the structure with new command my_command and function to be invoked if this command is typed on the shell.
const SHELL_COMMAND_STRUCT Shell_commands[] = {
{"my_command", my_command_function},
{"exit", Shell_exit},
{"help", Shell_help},
{NULL, NULL}
}
Explanation how the shell is used in application:
print_usage purpose is to represent boolean value to print the help or to execute the command. If it's FALSE, then command was typed, otherwise (TRUE) help was requested.
If help is typed without any following argument , number of arguments argc = 1 and argv[0] is help command. Value TRUE is stored in shorthelp.
Help with more arguments (help my_command), shorthelp holds FALSE.
Check an example which is using shell like HVAC.
Regards,
MartinK