2010-08-20 08:22:47 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2009-2010 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; version 2 of
|
|
|
|
* the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <readkey.h>
|
|
|
|
#include <menu.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <errno.h>
|
2016-08-18 14:05:03 +00:00
|
|
|
#include <libbb.h>
|
2010-08-21 18:09:51 +00:00
|
|
|
#include <linux/err.h>
|
2010-08-20 08:22:47 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
action_add,
|
|
|
|
action_remove,
|
|
|
|
action_select,
|
|
|
|
#endif
|
|
|
|
action_list,
|
|
|
|
action_show,
|
|
|
|
} menu_action;
|
|
|
|
|
|
|
|
struct cmd_menu {
|
|
|
|
char *menu;
|
|
|
|
menu_action action;
|
2012-04-23 06:27:02 +00:00
|
|
|
char *description;
|
|
|
|
int auto_select;
|
2010-08-20 08:22:47 +00:00
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
int entry;
|
|
|
|
int re_entrant;
|
|
|
|
char *command;
|
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-20 08:22:48 +00:00
|
|
|
char *submenu;
|
2010-08-20 08:22:47 +00:00
|
|
|
int num;
|
2010-09-17 13:45:54 +00:00
|
|
|
menu_entry_type type;
|
|
|
|
int box_state;
|
2010-08-20 08:22:47 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
2010-09-17 13:45:54 +00:00
|
|
|
#define OPTS "m:earlc:d:RsSn:u:A:b:B:"
|
2010-08-20 08:22:47 +00:00
|
|
|
#define is_entry(x) ((x)->entry)
|
|
|
|
#else
|
2012-04-23 06:27:02 +00:00
|
|
|
#define OPTS "m:lsA:d:"
|
2010-08-20 08:22:47 +00:00
|
|
|
#define is_entry(x) (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
/*
|
2010-09-17 13:45:54 +00:00
|
|
|
* menu -e -a -m <menu> -c <command> [-R] [-b 0|1 ] -d <description>
|
|
|
|
* menu -e -a -m <menu> -u submenu -d [-b 0|1] <description>
|
2010-08-20 08:22:47 +00:00
|
|
|
*/
|
|
|
|
static int do_menu_entry_add(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu_entry *me;
|
2010-08-21 18:09:51 +00:00
|
|
|
struct menu *m;
|
2010-08-20 08:22:47 +00:00
|
|
|
|
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-20 08:22:48 +00:00
|
|
|
if (!cm->menu || (!cm->command && !cm->submenu) || !cm->description)
|
2010-08-20 08:22:47 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
|
|
|
|
if (!m) {
|
|
|
|
eprintf("Menu '%s' not found\n", cm->menu);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-08-21 18:09:51 +00:00
|
|
|
if (cm->submenu)
|
|
|
|
me = menu_add_submenu(m, cm->submenu, cm->description);
|
|
|
|
else
|
2010-09-17 13:45:54 +00:00
|
|
|
me = menu_add_command_entry(m, cm->description, cm->command,
|
|
|
|
cm->type);
|
2016-07-06 19:32:48 +00:00
|
|
|
if (IS_ERR(me))
|
2010-08-21 18:09:51 +00:00
|
|
|
return PTR_ERR(me);
|
2010-08-20 08:22:47 +00:00
|
|
|
|
2010-09-17 13:45:54 +00:00
|
|
|
me->box_state = cm->box_state > 0 ? 1 : 0;
|
|
|
|
|
|
|
|
if (!cm->submenu)
|
|
|
|
me->non_re_ent = !cm->re_entrant;
|
2010-08-20 08:22:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* menu -e -r -m <name> -n <num>
|
|
|
|
*/
|
|
|
|
static int do_menu_entry_remove(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu *m;
|
|
|
|
struct menu_entry *me;
|
|
|
|
|
|
|
|
if (!cm->menu || cm->num < 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
|
|
|
|
if (!m) {
|
|
|
|
eprintf("Menu '%s' not found\n", cm->menu);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
me = menu_entry_get_by_num(m, cm->num);
|
|
|
|
|
|
|
|
if (!me) {
|
2010-12-20 23:02:02 +00:00
|
|
|
eprintf("Entry '%i' not found\n", cm->num);
|
2010-08-20 08:22:47 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
menu_remove_entry(m, me);
|
|
|
|
|
|
|
|
menu_entry_free(me);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* menu -a -m <name> -d <description>
|
|
|
|
*/
|
|
|
|
static int do_menu_add(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu *m;
|
|
|
|
int ret = -ENOMEM;
|
|
|
|
|
|
|
|
if (!cm->menu || !cm->description)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
m = menu_alloc();
|
|
|
|
|
|
|
|
if (!m)
|
|
|
|
goto free;
|
|
|
|
|
2010-08-21 15:02:09 +00:00
|
|
|
m->name = strdup(cm->menu);
|
2010-08-20 08:22:47 +00:00
|
|
|
if (!m->name)
|
|
|
|
goto free;
|
|
|
|
|
2016-11-23 08:41:33 +00:00
|
|
|
menu_add_title(m, cm->description);
|
2010-08-20 08:22:47 +00:00
|
|
|
|
|
|
|
ret = menu_add(m);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
goto free;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
free:
|
|
|
|
eprintf("Menu '%s' add fail", cm->menu);
|
|
|
|
if (ret == -EEXIST)
|
2016-04-14 07:35:13 +00:00
|
|
|
eprintf(" already exist");
|
|
|
|
eprintf("\n");
|
2010-08-20 08:22:47 +00:00
|
|
|
|
|
|
|
menu_free(m);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* menu -r -m <name>
|
|
|
|
*/
|
|
|
|
static int do_menu_remove(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu *m;
|
|
|
|
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
|
|
|
|
if (!m) {
|
|
|
|
eprintf("Menu '%s' not found\n", cm->menu);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
menu_remove(m);
|
|
|
|
|
|
|
|
menu_free(m);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* menu -m <menu> -S -n <entry num starting at 1>
|
|
|
|
*/
|
|
|
|
static int do_menu_select(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu *m;
|
|
|
|
|
|
|
|
if (cm->num < 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
|
|
|
|
if (!m) {
|
|
|
|
eprintf("Menu '%s' not found\n", cm->menu);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-09-17 13:45:52 +00:00
|
|
|
if (menu_set_selected(m, cm->num) < 0) {
|
2010-08-20 08:22:47 +00:00
|
|
|
eprintf("Entry '%d' not found\n", cm->num);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
2010-09-17 13:45:53 +00:00
|
|
|
* menu -s -m <menu> [-A <auto select delay>] [-d <display]
|
2010-08-20 08:22:47 +00:00
|
|
|
*/
|
|
|
|
static int do_menu_show(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu *m;
|
|
|
|
|
|
|
|
if (cm->menu)
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
else
|
|
|
|
m = menu_get_by_name("boot");
|
|
|
|
|
2010-09-17 13:45:53 +00:00
|
|
|
if (!m)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (cm->auto_select != -EINVAL) {
|
|
|
|
menu_set_auto_select(m, cm->auto_select);
|
|
|
|
|
|
|
|
free(m->auto_display);
|
|
|
|
|
|
|
|
m->auto_display = strdup(cm->description);
|
|
|
|
}
|
|
|
|
|
2010-08-20 08:22:47 +00:00
|
|
|
return menu_show(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void print_entries(struct menu *m)
|
|
|
|
{
|
|
|
|
struct menu_entry *me;
|
|
|
|
|
2010-08-21 16:27:31 +00:00
|
|
|
list_for_each_entry(me, &m->entries, list)
|
2010-08-20 08:22:47 +00:00
|
|
|
printf("%d: %s\n", me->num, me->display);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* menu -l
|
|
|
|
* menu -e -l [menu]
|
|
|
|
*/
|
|
|
|
static int do_menu_list(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
struct menu* m = NULL;
|
|
|
|
struct menu* menus = menu_get_menus();
|
|
|
|
|
2010-08-21 16:49:55 +00:00
|
|
|
if (!menus)
|
|
|
|
return 0;
|
|
|
|
|
2010-08-20 08:22:47 +00:00
|
|
|
if (is_entry(cm)) {
|
|
|
|
if (cm->menu)
|
|
|
|
m = menu_get_by_name(cm->menu);
|
|
|
|
|
|
|
|
if (m) {
|
|
|
|
print_entries(m);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-21 16:27:31 +00:00
|
|
|
list_for_each_entry(m, &menus->list, list) {
|
2016-08-18 14:05:03 +00:00
|
|
|
printf("%s: ", m->name);
|
|
|
|
if (m->display_lines) {
|
|
|
|
static char outstr[256];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
for (i = 0; i < m->display_lines; i++)
|
|
|
|
/* Conform to menu rendering logic */
|
|
|
|
if (IS_ENABLED(CONFIG_SHELL_HUSH)) {
|
|
|
|
process_escape_sequence(m->display[i], outstr, 256);
|
|
|
|
printf("\t%s\n", outstr);
|
|
|
|
} else {
|
|
|
|
printf("\t%s\n", m->display[i]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
printf("%s\n", m->name);
|
|
|
|
}
|
2010-08-20 08:22:47 +00:00
|
|
|
if (is_entry(cm))
|
|
|
|
print_entries(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
static int do_menu_entry(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
switch(cm->action) {
|
|
|
|
case action_list:
|
|
|
|
return do_menu_list(cm);
|
|
|
|
case action_remove:
|
|
|
|
return do_menu_entry_remove(cm);
|
|
|
|
case action_add:
|
|
|
|
return do_menu_entry_add(cm);
|
|
|
|
case action_select:
|
|
|
|
case action_show:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static int do_menu_entry(struct cmd_menu *cm)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_menu(int argc, char *argv[])
|
2010-08-20 08:22:47 +00:00
|
|
|
{
|
|
|
|
struct cmd_menu cm;
|
|
|
|
int opt;
|
|
|
|
int ret = -EINVAL;
|
|
|
|
|
|
|
|
if (!argc)
|
|
|
|
return COMMAND_ERROR_USAGE;
|
|
|
|
|
|
|
|
memset(&cm, 0, sizeof(struct cmd_menu));
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
cm.num = -EINVAL;
|
2010-09-17 13:45:53 +00:00
|
|
|
cm.auto_select = -EINVAL;
|
2010-08-20 08:22:47 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
cm.action = action_show;
|
|
|
|
|
|
|
|
while((opt = getopt(argc, argv, OPTS)) > 0) {
|
|
|
|
switch(opt) {
|
|
|
|
case 'm':
|
|
|
|
cm.menu = optarg;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
cm.action = action_list;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
cm.action = action_show;
|
|
|
|
break;
|
2012-04-23 06:27:02 +00:00
|
|
|
case 'A':
|
|
|
|
cm.auto_select = simple_strtoul(optarg, NULL, 10);
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
cm.description = optarg;
|
|
|
|
break;
|
2010-08-20 08:22:47 +00:00
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
case 'e':
|
|
|
|
cm.entry = 1;
|
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
cm.action = action_add;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
cm.action = action_remove;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
cm.command = optarg;
|
|
|
|
break;
|
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-20 08:22:48 +00:00
|
|
|
case 'u':
|
|
|
|
cm.submenu = optarg;
|
|
|
|
break;
|
2010-08-20 08:22:47 +00:00
|
|
|
case 'R':
|
|
|
|
cm.re_entrant = 1;
|
|
|
|
break;
|
|
|
|
case 'S':
|
|
|
|
cm.action = action_select;
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
cm.num = simple_strtoul(optarg, NULL, 10);
|
|
|
|
break;
|
2010-09-17 13:45:54 +00:00
|
|
|
case 'b':
|
|
|
|
cm.type = MENU_ENTRY_BOX;
|
|
|
|
cm.box_state = simple_strtoul(optarg, NULL, 10);
|
|
|
|
break;
|
|
|
|
case 'B':
|
|
|
|
cm.command = optarg;
|
2010-09-17 13:45:53 +00:00
|
|
|
break;
|
2010-08-20 08:22:47 +00:00
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_entry(&cm)) {
|
|
|
|
ret = do_menu_entry(&cm);
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(cm.action) {
|
|
|
|
case action_list:
|
|
|
|
ret = do_menu_list(&cm);
|
|
|
|
break;
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
|
|
|
case action_remove:
|
|
|
|
ret = do_menu_remove(&cm);
|
|
|
|
break;
|
|
|
|
case action_add:
|
|
|
|
ret = do_menu_add(&cm);
|
|
|
|
break;
|
|
|
|
case action_select:
|
|
|
|
ret = do_menu_select(&cm);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case action_show:
|
|
|
|
ret = do_menu_show(&cm);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
if (ret)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const __maybe_unused char cmd_menu_help[] =
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Manage Menu:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
" -m menu\n"
|
|
|
|
" -l list\n"
|
|
|
|
" -s show\n"
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Advanced menu management:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
" -e menu entry\n"
|
|
|
|
" -a add\n"
|
|
|
|
" -r remove\n"
|
|
|
|
" -S select\n"
|
|
|
|
#endif
|
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Show menu:\n"
|
2010-09-17 13:45:53 +00:00
|
|
|
" (-A auto select delay)\n"
|
|
|
|
" (-d auto select description)\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
" menu -s -m MENU [-A delay] [-d auto_display]\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"List menu:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
" menu -l\n"
|
|
|
|
"\n"
|
|
|
|
#if defined(CONFIG_CMD_MENU_MANAGEMENT)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Add a menu:\n"
|
|
|
|
" menu -a -m NAME -d DESC\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Remove a menu:\n"
|
|
|
|
" menu -r -m NAME\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Add an entry:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
" (-R for do no exit the menu after executing the command)\n"
|
2010-09-17 13:45:54 +00:00
|
|
|
" (-b for box style 1 for selected)\n"
|
|
|
|
" (and optional -c for the command to run when we change the state)\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
" menu -e -a -m MENU -c COMMAND [-R] [-b 0|1] -d DESC\n"
|
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-20 08:22:48 +00:00
|
|
|
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Add a submenu entry:\n"
|
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-20 08:22:48 +00:00
|
|
|
" (-R is not needed)\n"
|
2010-09-17 13:45:54 +00:00
|
|
|
" (-b for box style 1 for selected)\n"
|
|
|
|
" (and -c is not needed)\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
" menu -e -a -m MENU -u submenu -d [-b 0|1] DESC\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Remove an entry:\n"
|
|
|
|
" menu -e -r -m NAME -n ENTRY\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Select an entry:\n"
|
|
|
|
" menu -m <menu> -S -n ENTRY\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"List menu:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
" menu -e -l [menu]\n"
|
|
|
|
"\n"
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Menu examples:\n"
|
|
|
|
" menu -a -m boot -d \"Boot Menu\"\n"
|
|
|
|
" menu -e -a -m boot -c boot -d \"Boot\"\n"
|
|
|
|
" menu -e -a -m boot -c reset -d \"Reset\"\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
#else
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
"Menu example:\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
#endif
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
" menu -s -m boot\n"
|
2010-08-20 08:22:47 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(menu)
|
|
|
|
.cmd = do_menu,
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_DESC("create and display menus")
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
|
2010-08-20 08:22:47 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_menu_help)
|
|
|
|
BAREBOX_CMD_END
|