blob: 9f8393eefd81f6ccea9a99f6cbd2d0779db3d611 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peter Tysereabe6d92009-10-16 17:36:25 -05002/*
3 * Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Peter Tysereabe6d92009-10-16 17:36:25 -05005 */
6
7#include <common.h>
8#include <command.h>
9
Simon Glassed38aef2020-05-10 11:40:03 -060010static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
11 char *const argv[])
Peter Tysereabe6d92009-10-16 17:36:25 -050012{
Simon Glass4ef90b72016-03-19 02:18:38 -060013#ifdef CONFIG_CMDLINE
Simon Glassed38aef2020-05-10 11:40:03 -060014 struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
15 const int len = ll_entry_count(struct cmd_tbl, cmd);
Marek Vasut69c5e342012-10-12 10:27:04 +000016 return _do_help(start, len, cmdtp, flag, argc, argv);
Simon Glass4ef90b72016-03-19 02:18:38 -060017#else
18 return 0;
19#endif
Peter Tysereabe6d92009-10-16 17:36:25 -050020}
21
22U_BOOT_CMD(
23 help, CONFIG_SYS_MAXARGS, 1, do_help,
Peter Tyser2d2712a2009-10-16 17:36:26 -050024 "print command description/usage",
25 "\n"
26 " - print brief description of all commands\n"
27 "help command ...\n"
28 " - print detailed usage of 'command'"
Peter Tysereabe6d92009-10-16 17:36:25 -050029);
30
Andrej Rosano6533a7e2019-07-29 09:24:53 +020031#ifdef CONFIG_CMDLINE
Tom Rini03f146c2023-10-07 15:13:08 -040032/*
33 * This does not use the U_BOOT_CMD macro as ? can't be used in symbol names
34 * nor can we rely on the CONFIG_SYS_LONGHELP helper macro
35 */
Simon Glassed38aef2020-05-10 11:40:03 -060036ll_entry_declare(struct cmd_tbl, question_mark, cmd) = {
Boris Brezillonc71dfd12018-12-03 22:54:20 +010037 "?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
Peter Tysereabe6d92009-10-16 17:36:25 -050038 "alias for 'help'",
Peter Tyser2d2712a2009-10-16 17:36:26 -050039#ifdef CONFIG_SYS_LONGHELP
Peter Tysereabe6d92009-10-16 17:36:25 -050040 ""
Peter Tysereabe6d92009-10-16 17:36:25 -050041#endif /* CONFIG_SYS_LONGHELP */
Peter Tyser2d2712a2009-10-16 17:36:26 -050042};
Andrej Rosano6533a7e2019-07-29 09:24:53 +020043#endif