diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine/HelpCommand.cs')
| -rw-r--r-- | src/WixToolset.Core/CommandLine/HelpCommand.cs | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/WixToolset.Core/CommandLine/HelpCommand.cs b/src/WixToolset.Core/CommandLine/HelpCommand.cs index 78845189..3af442aa 100644 --- a/src/WixToolset.Core/CommandLine/HelpCommand.cs +++ b/src/WixToolset.Core/CommandLine/HelpCommand.cs | |||
| @@ -3,27 +3,60 @@ | |||
| 3 | namespace WixToolset.Core.CommandLine | 3 | namespace WixToolset.Core.CommandLine |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Linq; | ||
| 6 | using System.Threading; | 8 | using System.Threading; |
| 7 | using System.Threading.Tasks; | 9 | using System.Threading.Tasks; |
| 10 | using WixToolset.Extensibility; | ||
| 8 | using WixToolset.Extensibility.Data; | 11 | using WixToolset.Extensibility.Data; |
| 9 | using WixToolset.Extensibility.Services; | 12 | using WixToolset.Extensibility.Services; |
| 10 | 13 | ||
| 11 | internal class HelpCommand : ICommandLineCommand | 14 | internal class HelpCommand : ICommandLineCommand |
| 12 | { | 15 | { |
| 16 | private static readonly ExtensionCommandLineSwitch[] BuiltInSwitches = new ExtensionCommandLineSwitch[] | ||
| 17 | { | ||
| 18 | new ExtensionCommandLineSwitch { Switch = "build", Description = "Build a wixlib, package or bundle." }, | ||
| 19 | new ExtensionCommandLineSwitch { Switch = "decompile", Description = "Decompile a package or bundle into source code." }, | ||
| 20 | }; | ||
| 21 | |||
| 22 | public HelpCommand(IEnumerable<IExtensionCommandLine> extensions) | ||
| 23 | { | ||
| 24 | this.Extensions = extensions; | ||
| 25 | } | ||
| 26 | |||
| 13 | public bool ShowLogo => true; | 27 | public bool ShowLogo => true; |
| 14 | 28 | ||
| 15 | public bool StopParsing => true; | 29 | public bool StopParsing => true; |
| 16 | 30 | ||
| 31 | private IEnumerable<IExtensionCommandLine> Extensions { get; } | ||
| 32 | |||
| 17 | public Task<int> ExecuteAsync(CancellationToken _) | 33 | public Task<int> ExecuteAsync(CancellationToken _) |
| 18 | { | 34 | { |
| 19 | Console.WriteLine("TODO: Show list of available commands"); | 35 | var commandLineSwitches = new List<ExtensionCommandLineSwitch>(BuiltInSwitches); |
| 36 | commandLineSwitches.AddRange(this.Extensions.SelectMany(e => e.CommandLineSwitches).OrderBy(s => s.Switch, StringComparer.Ordinal)); | ||
| 37 | |||
| 38 | Console.WriteLine(); | ||
| 39 | Console.WriteLine("Usage: wix [option]"); | ||
| 40 | Console.WriteLine("Usage: wix [command]"); | ||
| 41 | Console.WriteLine(); | ||
| 42 | Console.WriteLine("Options:"); | ||
| 43 | Console.WriteLine(" -h|--help Show command line help."); | ||
| 44 | Console.WriteLine(" --version Display WiX Toolset version in use."); | ||
| 45 | Console.WriteLine(); | ||
| 46 | |||
| 47 | Console.WriteLine("Commands:"); | ||
| 48 | foreach (var commandLineSwitch in commandLineSwitches) | ||
| 49 | { | ||
| 50 | Console.WriteLine(" {0,-17} {1}", commandLineSwitch.Switch, commandLineSwitch.Description); | ||
| 51 | } | ||
| 52 | |||
| 53 | Console.WriteLine(); | ||
| 54 | Console.WriteLine("Run 'wix [command] --help' for more information on a command."); | ||
| 55 | AppCommon.DisplayToolFooter(); | ||
| 20 | 56 | ||
| 21 | return Task.FromResult(-1); | 57 | return Task.FromResult(-1); |
| 22 | } | 58 | } |
| 23 | 59 | ||
| 24 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) | 60 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) => true; // eat any arguments |
| 25 | { | ||
| 26 | return true; // eat any arguments | ||
| 27 | } | ||
| 28 | } | 61 | } |
| 29 | } | 62 | } |
