[mono/mono-addins] [2 commits] 3fc08f00: Throw if --all is not the first parameter.

"Lluis Sanchez ([email protected])" <[email protected]> Mon, 11 Nov 2013 12:28:19 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014247224d87-a0d4d6cd-ed2c-4084-a7da-9150c1fcc406-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono-addins
  Compare: https://github.com/mono/mono-addins/compare/74db777e7182...63a5ccef8206

   Commit: 3fc08f00dc03ef25a6459762dc4c01218e6c3743
   Author: Ungureanu Marius <[email protected]> (Therzok)
     Date: 2013-11-10 16:33:57 GMT
      URL: https://github.com/mono/mono-addins/commit/3fc08f00dc03ef25a6459762dc4c01218e6c3743

Throw if --all is not the first parameter.

Changed paths:
  M Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs

Modified: Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs
===================================================================
@@ -529,14 +529,34 @@ void DumpRegistryFile (string[] args)
 		void PrintAddinInfo (string[] args)
 		{
 			bool generateXml = false;
-			bool generateAll = false;
 			bool pickNamespace = false;
 			bool extensionModel = true;
 			
 			ArrayList addins = new ArrayList ();
 			ArrayList namespaces = new ArrayList ();
+
+			bool generateAll = args [0] == "--all";
+			if (!generateAll) {
+				AddinDescription desc = null;
+				if (File.Exists (args [0]))
+					desc = registry.GetAddinDescription (new ConsoleProgressStatus (verbose), args [0]);
+				else {
+					Addin addin = registry.GetAddin (args [0]);
+					if (addin != null)
+						desc = addin.Description;
+				}
+				if (desc == null)
+					throw new InstallException (string.Format ("Add-in '{0}' not found.", args [0]));
+				if (desc != null)
+					addins.Add (desc);
+			}
 			
-			foreach (string a in args) {
+			for (int i = 1; i < args.Length; i++) {
+				string a = args [i];
+
+				if (a == "--all")
+					throw new InstallException (string.Format ("--all needs to be the first parameter"));
+
 				if (pickNamespace) {
 					namespaces.Add (a);
 					pickNamespace = false;
@@ -550,31 +570,10 @@ void PrintAddinInfo (string[] args)
 					pickNamespace = true;
 					continue;
 				}
-				if (a == "--all") {
-					generateAll = true;
-					continue;
-				}
 				if (a == "--full") {
 					extensionModel = false;
 					continue;
 				}
-
-				// We don't require file parameter if we're generating for all.
-				if (generateAll)
-					continue;
-
-				AddinDescription desc = null;
-				if (File.Exists (args [0]))
-					desc = registry.GetAddinDescription (new Mono.Addins.ConsoleProgressStatus (verbose), args [0]);
-				else {
-					Addin addin = registry.GetAddin (args [0]);
-					if (addin != null)
-						desc = addin.Description;
-				}
-				if (desc == null)
-					throw new InstallException (string.Format ("Add-in '{0}' not found.", a));
-				if (desc != null)
-					addins.Add (desc);
 			}
 			
 			if (generateAll) {
@@ -1088,11 +1087,10 @@ void CreateCommands ()
 			commands.Add (cmd);
 
 			cmd = new SetupCommand (cat, "info", null, new SetupCommandHandler (PrintAddinInfo));
-			cmd.Usage = "[addin-id|addin-file] [--xml] [--all] [--full] [--namespace <namespace>]";
+			cmd.Usage = "[addin-id|addin-file|--all] [--xml] [--full] [--namespace <namespace>]";
 			cmd.Description = "Prints information about add-ins.";
 			cmd.AppendDesc ("Prints information about add-ins. Options:\n");
 			cmd.AppendDesc (" --xml: Dump the information using an XML format.\n");
-			cmd.AppendDesc (" --all: Dump information from all add-ins.\n");
 			cmd.AppendDesc (" --full: Include add-ins which don't define extension points.\n");
 			cmd.AppendDesc (" --namespace ns: Include only add-ins from the specified 'ns' namespace.");
 			commands.Add (cmd);

   Commit: 63a5ccef8206ae6337f45df838e79fc2a4673417
   Author: Lluis Sanchez <[email protected]> (slluis)
     Date: 2013-11-11 12:26:15 GMT
      URL: https://github.com/mono/mono-addins/commit/63a5ccef8206ae6337f45df838e79fc2a4673417

Merge pull request #10 from mono/cleanup

Throw if --all is not the first parameter.

Changed paths:
  M Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs

Modified: Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs
===================================================================
@@ -529,14 +529,34 @@ void DumpRegistryFile (string[] args)
 		void PrintAddinInfo (string[] args)
 		{
 			bool generateXml = false;
-			bool generateAll = false;
 			bool pickNamespace = false;
 			bool extensionModel = true;
 			
 			ArrayList addins = new ArrayList ();
 			ArrayList namespaces = new ArrayList ();
+
+			bool generateAll = args [0] == "--all";
+			if (!generateAll) {
+				AddinDescription desc = null;
+				if (File.Exists (args [0]))
+					desc = registry.GetAddinDescription (new ConsoleProgressStatus (verbose), args [0]);
+				else {
+					Addin addin = registry.GetAddin (args [0]);
+					if (addin != null)
+						desc = addin.Description;
+				}
+				if (desc == null)
+					throw new InstallException (string.Format ("Add-in '{0}' not found.", args [0]));
+				if (desc != null)
+					addins.Add (desc);
+			}
 			
-			foreach (string a in args) {
+			for (int i = 1; i < args.Length; i++) {
+				string a = args [i];
+
+				if (a == "--all")
+					throw new InstallException (string.Format ("--all needs to be the first parameter"));
+
 				if (pickNamespace) {
 					namespaces.Add (a);
 					pickNamespace = false;
@@ -550,31 +570,10 @@ void PrintAddinInfo (string[] args)
 					pickNamespace = true;
 					continue;
 				}
-				if (a == "--all") {
-					generateAll = true;
-					continue;
-				}
 				if (a == "--full") {
 					extensionModel = false;
 					continue;
 				}
-
-				// We don't require file parameter if we're generating for all.
-				if (generateAll)
-					continue;
-
-				AddinDescription desc = null;
-				if (File.Exists (args [0]))
-					desc = registry.GetAddinDescription (new Mono.Addins.ConsoleProgressStatus (verbose), args [0]);
-				else {
-					Addin addin = registry.GetAddin (args [0]);
-					if (addin != null)
-						desc = addin.Description;
-				}
-				if (desc == null)
-					throw new InstallException (string.Format ("Add-in '{0}' not found.", a));
-				if (desc != null)
-					addins.Add (desc);
 			}
 			
 			if (generateAll) {
@@ -1088,11 +1087,10 @@ void CreateCommands ()
 			commands.Add (cmd);
 
 			cmd = new SetupCommand (cat, "info", null, new SetupCommandHandler (PrintAddinInfo));
-			cmd.Usage = "[addin-id|addin-file] [--xml] [--all] [--full] [--namespace <namespace>]";
+			cmd.Usage = "[addin-id|addin-file|--all] [--xml] [--full] [--namespace <namespace>]";
 			cmd.Description = "Prints information about add-ins.";
 			cmd.AppendDesc ("Prints information about add-ins. Options:\n");
 			cmd.AppendDesc (" --xml: Dump the information using an XML format.\n");
-			cmd.AppendDesc (" --all: Dump information from all add-ins.\n");
 			cmd.AppendDesc (" --full: Include add-ins which don't define extension points.\n");
 			cmd.AppendDesc (" --namespace ns: Include only add-ins from the specified 'ns' namespace.");
 			commands.Add (cmd);


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches