| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Core.ExtensionCache |
| 4 | { |
| 5 | using System; |
| 6 | using WixToolset.Extensibility; |
| 7 | using WixToolset.Extensibility.Data; |
| 8 | using WixToolset.Extensibility.Services; |
| 9 | |
| 10 | /// <summary> |
| 11 | /// Parses the "extension" command-line command. See <c>ExtensionCacheManagerCommand</c> |
| 12 | /// for the bulk of the command-line processing. |
| 13 | /// </summary> |
| 14 | internal class ExtensionCacheManagerExtensionCommandLine : BaseExtensionCommandLine |
| 15 | { |
| 16 | public ExtensionCacheManagerExtensionCommandLine(IServiceProvider serviceProvider) |
| 17 | { |
| 18 | this.ServiceProvider = serviceProvider; |
| 19 | } |
| 20 | |
| 21 | private IServiceProvider ServiceProvider { get; } |
| 22 | |
| 23 | public override CommandLineHelp GetCommandLineHelp() |
| 24 | { |
| 25 | return new CommandLineHelp("Manage the extension cache.") |
| 26 | { |
| 27 | Commands = new[] { new CommandLineHelpCommand("extension", "Manage WiX extension cache.") } |
| 28 | }; |
| 29 | } |
| 30 | |
| 31 | public override bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command) |
| 32 | { |
| 33 | command = null; |
| 34 | |
| 35 | if ("extension".Equals(argument, StringComparison.OrdinalIgnoreCase)) |
| 36 | { |
| 37 | command = new ExtensionCacheManagerCommand(this.ServiceProvider); |
| 38 | } |
| 39 | |
| 40 | return command != null; |
| 41 | } |
| 42 | } |
| 43 | } |