diff options
author | Ungureanu Marius <teromario@yahoo.com> | 2013-11-10 20:33:57 +0400 |
---|---|---|
committer | Ungureanu Marius <teromario@yahoo.com> | 2013-11-10 20:33:57 +0400 |
commit | 3fc08f00dc03ef25a6459762dc4c01218e6c3743 (patch) | |
tree | 7df21e2456c7d8c47c72d6234ed64fce77968d19 /Mono.Addins.Setup | |
parent | 74db777e71829bf7fa6a73761f0b4f59e3f60d4b (diff) |
Throw if --all is not the first parameter.
Diffstat (limited to 'Mono.Addins.Setup')
-rw-r--r-- | Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs b/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs index 3c98847..f9c0181 100644 --- a/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs +++ b/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs @@ -529,14 +529,34 @@ namespace Mono.Addins.Setup 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 @@ namespace Mono.Addins.Setup 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 @@ namespace Mono.Addins.Setup 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); |