ShellPkg: handle '-t or -terse' and '-s' flags for 'ver' command properly

'-t or -terse' and '-s' flags are multiple exclusive
So when both flags are used together, command should report an error message.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
Tapan Shah 2016-10-24 09:56:37 -07:00 committed by Jaben Carsey
parent 60d9f5f43b
commit 9d54bf4e7e

View File

@ -1,6 +1,7 @@
/** @file /** @file
Main file for Ver shell level 3 function. Main file for Ver shell level 3 function.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR> (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
@ -84,15 +85,20 @@ ShellCommandRunVer (
ShellStatus = SHELL_INVALID_PARAMETER; ShellStatus = SHELL_INVALID_PARAMETER;
} else { } else {
if (ShellCommandLineGetFlag(Package, L"-s")) { if (ShellCommandLineGetFlag(Package, L"-s")) {
ShellPrintHiiEx ( if (ShellCommandLineGetFlag(Package, L"-terse") || ShellCommandLineGetFlag(Package, L"-t")){
0, ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel3HiiHandle, L"ver", L"-t or -terse", L"-s");
gST->ConOut->Mode->CursorRow, ShellStatus = SHELL_INVALID_PARAMETER;
NULL, } else {
STRING_TOKEN (STR_VER_OUTPUT_SIMPLE), ShellPrintHiiEx (
gShellLevel3HiiHandle, 0,
gEfiShellProtocol->MajorVersion, gST->ConOut->Mode->CursorRow,
gEfiShellProtocol->MinorVersion NULL,
); STRING_TOKEN (STR_VER_OUTPUT_SIMPLE),
gShellLevel3HiiHandle,
gEfiShellProtocol->MajorVersion,
gEfiShellProtocol->MinorVersion
);
}
} else { } else {
ShellPrintHiiEx ( ShellPrintHiiEx (
0, 0,