aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerExtensionCommandLine.cs
blob: 765878307b0c7d2c6c4dd3bb49bb269eb06572c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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.

namespace WixToolset.Core.ExtensionCache
{
    using System;
    using System.Collections.Generic;
    using WixToolset.Extensibility;
    using WixToolset.Extensibility.Data;
    using WixToolset.Extensibility.Services;

    /// <summary>
    /// Parses the "extension" command-line command. See <c>ExtensionCacheManagerCommand</c>
    /// for the bulk of the command-line processing.
    /// </summary>
    internal class ExtensionCacheManagerExtensionCommandLine : BaseExtensionCommandLine
    {
        public ExtensionCacheManagerExtensionCommandLine(IServiceProvider serviceProvider)
        {
            this.ServiceProvider = serviceProvider;
        }

        private IServiceProvider ServiceProvider { get; }

        public override IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches => new ExtensionCommandLineSwitch[]
        {
            new ExtensionCommandLineSwitch { Switch = "extension", Description = "Manage extension cache." },
        };

        public override bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command)
        {
            command = null;

            if ("extension".Equals(argument, StringComparison.OrdinalIgnoreCase))
            {
                command = new ExtensionCacheManagerCommand(this.ServiceProvider);
            }

            return command != null;
        }
    }
}