blob: a1a0b99b6ffac7c8e3888837c5d1af97f64f75fc [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
Kim Phillipsdc00a682012-10-29 13:34:31 +000010static int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Peter Tysereabe6d92009-10-16 17:36:25 -050011{
Simon Glass4ef90b72016-03-19 02:18:38 -060012#ifdef CONFIG_CMDLINE
Marek Vasut69c5e342012-10-12 10:27:04 +000013 cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd);
14 const int len = ll_entry_count(cmd_tbl_t, cmd);
15 return _do_help(start, len, cmdtp, flag, argc, argv);
Simon Glass4ef90b72016-03-19 02:18:38 -060016#else
17 return 0;
18#endif
Peter Tysereabe6d92009-10-16 17:36:25 -050019}
20
21U_BOOT_CMD(
22 help, CONFIG_SYS_MAXARGS, 1, do_help,
Peter Tyser2d2712a2009-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 Tysereabe6d92009-10-16 17:36:25 -050028);
29
Andrej Rosano6533a7e2019-07-29 09:24:53 +020030#ifdef CONFIG_CMDLINE
Peter Tysereabe6d92009-10-16 17:36:25 -050031/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
Albert ARIBAUDc24895e2013-02-25 00:59:00 +000032ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
Boris Brezillonc71dfd12018-12-03 22:54:20 +010033 "?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
Peter Tysereabe6d92009-10-16 17:36:25 -050034 "alias for 'help'",
Peter Tyser2d2712a2009-10-16 17:36:26 -050035#ifdef CONFIG_SYS_LONGHELP
Peter Tysereabe6d92009-10-16 17:36:25 -050036 ""
Peter Tysereabe6d92009-10-16 17:36:25 -050037#endif /* CONFIG_SYS_LONGHELP */
Peter Tyser2d2712a2009-10-16 17:36:26 -050038};
Andrej Rosano6533a7e2019-07-29 09:24:53 +020039#endif