Loading...
Searching...
No Matches
help.c
1/***********************************************************************************
2 * @file help.c *
3 * @author Matt Ricci *
4 * @addtogroup Shell *
5 * *
6 * @{ *
7 ***********************************************************************************/
8
9#include "stdint.h"
10
11#include "string.h"
12
13#include "shell.h"
14
15static void Help_exec(UART_t *, char *);
16extern uint32_t __shell_vector_start;
17extern uint32_t __shell_vector_end;
18
19DEFINE_PROGRAM_HANDLE("help", Help_exec, NULL)
20
21/* =============================================================================== */
26static void Help_exec(UART_t *uart, char *flags) {
27
28 for (uint32_t *i = (uint32_t *)&__shell_vector_start; i < (uint32_t *)&__shell_vector_end; i++) {
30 if (!strcmp(handle->name, flags)) {
31 if (handle->help == NULL)
32 uart->println(uart, "No help documentation found.");
33 else
34 handle->help(uart);
35 return;
36 }
37 }
38
39 uart->println(uart, "Use `help [name]` for more information on a specific command");
40 uart->println(uart, "The following commands are currently available:");
41 for (uint32_t *i = (uint32_t *)&__shell_vector_start; i < (uint32_t *)&__shell_vector_end; i++) {
43 if (strcmp(handle->name, "")) {
44 uart->print(uart, ":");
45 uart->print(uart, handle->name);
46 uart->print(uart, "\n\r");
47 }
48 }
49 uart->println(uart, "Use <Ctrl+z> to toggle the Australis core between paused and active states.");
50 uart->println(uart, "Use <Ctrl+c> to kill an active command.");
51}
52
char name[SHELL_PROGRAM_NAME_LENGTH]
Program name as referenced by the shell.
Definition shell.h:61
void(* help)(UART_t *)
Program help-string print function.
Definition shell.h:63
Struct definition for shell program handle.
Definition shell.h:60
Struct definition for UART interface.
Definition uart.h:132