Added --list option to variant command
authorTom Sutcliffe <thomas.sutcliffe@accenture.com>
Thu, 26 Aug 2010 15:28:08 +0100
changeset 41 4a2ffd3562a3
parent 40 d9b3ed11f017
child 42 e81b4e28b3e2
Added --list option to variant command
commands/variant/variant.cif
commands/variant/variant.cpp
commands/variant/variant.h
--- a/commands/variant/variant.cif	Thu Aug 26 11:47:04 2010 +0100
+++ b/commands/variant/variant.cif	Thu Aug 26 15:28:08 2010 +0100
@@ -36,6 +36,10 @@
 
 Display verbose output.
 
+==option bool l list
+
+List the variant names that this command understands. Note this is all of them, not just the ones that match the current platform.
+
 ==argument string variantname optional multiple
 
 A symbolic name for the hardware variant may be specified instead of having to know the machine uid. This maximises compatibility with platforms that provide a custom variant.exe and/or that need more than just the machine UID to determine the variant. Check the platform-specific documentation for what variant string is used to identify that platform's hardware. If multiple variant names are specified KErrNone is returned if any one of them matches.
--- a/commands/variant/variant.cpp	Thu Aug 26 11:47:04 2010 +0100
+++ b/commands/variant/variant.cpp	Thu Aug 26 15:28:08 2010 +0100
@@ -72,6 +72,19 @@
 
 void CCmdVariant::DoRunL()
 	{
+	if (iList)
+		{
+		Printf(_L("Supported variants: "));
+		for (TInt i = 0; i < KMachineIdVariantCount; i++)
+			{
+			Printf(_L("%S, "), &KMachineIdVariants[i].iName);
+			}
+		// Finally add the ones which don't appear in KMachineIdVariants
+		Write(_L("wins, target\r\n"));
+		Complete(KErrNone);
+		return;
+		}
+
 	if (iMachineId.Count() == 0 && iVariant.Count() == 0)
 		{
 		LeaveIfErr(KErrArgument, _L("You must specify at least one <variantname> argument or --uid option"));
@@ -137,6 +150,8 @@
 	aOptions.AppendUintL(iMachineId, KCmdOptUid);
 	_LIT(KOptVerbose, "verbose");
 	aOptions.AppendBoolL(iVerbose, KOptVerbose);
+	_LIT(KOptList, "list");
+	aOptions.AppendBoolL(iList, KOptList);
 	}
 
 //
--- a/commands/variant/variant.h	Thu Aug 26 11:47:04 2010 +0100
+++ b/commands/variant/variant.h	Thu Aug 26 15:28:08 2010 +0100
@@ -32,4 +32,5 @@
 	RArray<TUint> iMachineId;
 	RPointerArray<HBufC> iVariant;
 	TBool iVerbose;
+	TBool iList;
 	};