blob: 56579e28d31d7dfd0aa25130f8eb7093ea631783 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peter Tyser6b8f5ad2009-10-16 17:36:25 -05002/*
3 * Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Peter Tyser6b8f5ad2009-10-16 17:36:25 -05005 */
6
Peter Tyser6b8f5ad2009-10-16 17:36:25 -05007#include <command.h>
8
Simon Glass09140112020-05-10 11:40:03 -06009static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
10 char *const argv[])
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050011{
Simon Glassf8bb6962016-03-19 02:18:38 -060012#ifdef CONFIG_CMDLINE
Simon Glass09140112020-05-10 11:40:03 -060013 struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
14 const int len = ll_entry_count(struct cmd_tbl, cmd);
Marek Vasut6c7c9462012-10-12 10:27:04 +000015 return _do_help(start, len, cmdtp, flag, argc, argv);
Simon Glassf8bb6962016-03-19 02:18:38 -060016#else
17 return 0;
18#endif
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050019}
20
21U_BOOT_CMD(
22 help, CONFIG_SYS_MAXARGS, 1, do_help,
Peter Tyser4e1ca932009-10-16 17:36:26 -050023 "print command description/usage",
24 "\n"
25 " - print brief description of all commands\n"
26 "help command ...\n"
27 " - print detailed usage of 'command'"
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050028);
29
Andrej Rosano81b11582019-07-29 09:24:53 +020030#ifdef CONFIG_CMDLINE
Tom Rini36162182023-10-07 15:13:08 -040031/*
32 * This does not use the U_BOOT_CMD macro as ? can't be used in symbol names
33 * nor can we rely on the CONFIG_SYS_LONGHELP helper macro
34 */
Simon Glass09140112020-05-10 11:40:03 -060035ll_entry_declare(struct cmd_tbl, question_mark, cmd) = {
Boris Brezillon80a48dd2018-12-03 22:54:20 +010036 "?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050037 "alias for 'help'",
Peter Tyser4e1ca932009-10-16 17:36:26 -050038#ifdef CONFIG_SYS_LONGHELP
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050039 ""
Peter Tyser6b8f5ad2009-10-16 17:36:25 -050040#endif /* CONFIG_SYS_LONGHELP */
Peter Tyser4e1ca932009-10-16 17:36:26 -050041};
Andrej Rosano81b11582019-07-29 09:24:53 +020042#endif