Files
slimbootloader/BootloaderCommonPkg/Library/ShellLib/CmdHelp.c
T

70 lines
1.5 KiB
C
Raw Normal View History

2018-09-13 16:11:07 -07:00
/** @file
Shell command `help` to display the list of supported shell commands.
2019-07-22 22:28:20 -07:00
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
2019-06-12 18:01:09 -07:00
SPDX-License-Identifier: BSD-2-Clause-Patent
2018-09-13 16:11:07 -07:00
**/
#include <Library/ShellLib.h>
2019-07-22 22:28:20 -07:00
#include <Library/DebugLib.h>
#include "Shell.h"
2018-09-13 16:11:07 -07:00
/**
Display list of supported shell commands.
@param[in] Shell shell instance
@param[in] Argc number of command line arguments
@param[in] Argv command line arguments
@retval EFI_SUCCESS
**/
STATIC
EFI_STATUS
EFIAPI
ShellCommandHelpFunc (
IN SHELL *Shell,
IN UINTN Argc,
IN CHAR16 *Argv[]
);
CONST SHELL_COMMAND ShellCommandHelp = {
L"help",
L"List supported commands",
&ShellCommandHelpFunc
};
/**
Display list of supported shell commands.
@param[in] Shell shell instance
@param[in] Argc number of command line arguments
@param[in] Argv command line arguments
@retval EFI_SUCCESS
**/
STATIC
EFI_STATUS
EFIAPI
ShellCommandHelpFunc (
IN SHELL *Shell,
IN UINTN Argc,
IN CHAR16 *Argv[]
)
{
2019-07-22 22:28:20 -07:00
LIST_ENTRY *EntryList;
LIST_ENTRY *Link;
SHELL_COMMAND_LIST_ENTRY *Entry;
2018-09-13 16:11:07 -07:00
2019-07-22 22:28:20 -07:00
EntryList = GetShellCommandEntryList ();
for (Link = EntryList->ForwardLink; Link != EntryList; Link = Link->ForwardLink) {
Entry = CR (Link, SHELL_COMMAND_LIST_ENTRY, Link, SHELL_COMMAND_LIST_ENTRY_SIGNATURE);
2018-09-13 16:11:07 -07:00
2019-07-22 22:28:20 -07:00
ShellPrint (L"%-8s - %s\n", Entry->ShellCommand->Name, Entry->ShellCommand->Desc);
2018-09-13 16:11:07 -07:00
}
return EFI_SUCCESS;
}