blob: 701ae7e9056ce01d5c0109a690b6f2b7861e9a9f [file] [log] [blame]
Peter Tysereabe6d92009-10-16 17:36:25 -05001/*
2 * Copyright 2000-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Peter Tysereabe6d92009-10-16 17:36:25 -05006 */
7
8#include <common.h>
9#include <command.h>
10
Kim Phillipsdc00a682012-10-29 13:34:31 +000011static int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Peter Tysereabe6d92009-10-16 17:36:25 -050012{
Simon Glass4ef90b72016-03-19 02:18:38 -060013#ifdef CONFIG_CMDLINE
Marek Vasut69c5e342012-10-12 10:27:04 +000014 cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd);
15 const int len = ll_entry_count(cmd_tbl_t, cmd);
16 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
31/* 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) = {
Peter Tysereabe6d92009-10-16 17:36:25 -050033 "?", CONFIG_SYS_MAXARGS, 1, do_help,
34 "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};