#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/queue.h>
#include "cli_map.h"
#include "cne_common.h"
Go to the source code of this file.
CNE Command line interface
Definition in file cli_help.h.
◆ cli_help_find_group()
CNDP_API struct help_node* cli_help_find_group |
( |
const char * |
group | ) |
|
Find the help group section defined by the group string.
- Note
- Uses thread variable this_cli.
- Parameters
-
group | The group string name to find. |
- Returns
- NULL if not found or pointer to struct cli_info.
◆ cli_help_show_all()
CNDP_API int cli_help_show_all |
( |
const char * |
msg | ) |
|
Show the map table entries
- Parameters
-
msg | Pointer to a message to print first. |
- Returns
- 0 on success or -1 on error
◆ cli_help_show_group()
CNDP_API int cli_help_show_group |
( |
const char * |
group | ) |
|
Show the help message for the user.
- Note
- Uses thread variable this_cli.
- Parameters
-
group | Pointer to the cli_info structure. |
◆ cli_help_add()
CNDP_API int cli_help_add |
( |
const char * |
group, |
|
|
struct cli_map * |
map, |
|
|
const char ** |
hd |
|
) |
| |
Add help string group to a help structure
- Parameters
-
group | The group name for this help list |
map | The pointer to the MAP structure if present. |
hd | The array of string pointers for the help group |
- Returns
- 0 on OK and -1 on error
◆ is_help()
static int is_help |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
inlinestatic |
Find if the last item is a help request.
- Parameters
-
argc | Number of args in the argv list. |
argv | List of strings to parser |
- Returns
- 1 if true or 0 if false
Definition at line 100 of file cli_help.h.
◆ cli_help_foreach()
CNDP_API void cli_help_foreach |
( |
void(*)(void *arg, const char **h) |
func, |
|
|
void * |
arg |
|
) |
| |
Iterate over the help messages calling a given function.
- Parameters
-
func | A function to call for all help lines. |
arg | Argument pointer for function call. |
- Returns
- N/A
◆ cli_cmd_error()
CNDP_API int cli_cmd_error |
( |
const char * |
msg, |
|
|
const char * |
group, |
|
|
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Process a CLI command error
- Parameters
-
msg | The message to display on error |
group | The group string for this command |
argc | Number or arguments in the argv array |
argv | The array of string pointers for the command line. |
- Returns
- 0 on success or -1 on error