aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Extensibility/IExtensionCommandLine.cs
blob: 2c7d0a7e171760937257e509a08a3e97d05e4ea0 (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
42
43
44
45
46
47
48
// 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.Extensibility
{
    using System.Collections.Generic;
    using WixToolset.Extensibility.Data;
    using WixToolset.Extensibility.Services;

    /// <summary>
    /// Interface extensions implement to be able to parse the command-line.
    /// </summary>
    public interface IExtensionCommandLine
    {
        /// <summary>
        /// Gets the supported command line types for this extension.
        /// </summary>
        /// <value>The supported command line types for this extension.</value>
        IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches { get; }

        /// <summary>
        /// Called before the command-line is parsed.
        /// </summary>
        /// <param name="context">Information about the command-line to be parsed.</param>
        void PreParse(ICommandLineContext context);

        /// <summary>
        /// Gives the extension an opportunity pass a command-line argument for another command.
        /// </summary>
        /// <param name="parser">Parser to help parse the argument and additional arguments.</param>
        /// <param name="argument">Argument to parse.</param>
        /// <returns>True if the argument is recognized; otherwise false to allow another extension to process it.</returns>
        bool TryParseArgument(ICommandLineParser parser, string argument);

        /// <summary>
        /// Gives the extension an opportunity to provide a command.
        /// </summary>
        /// <param name="parser">Parser to help parse the argument and additional arguments.</param>
        /// <param name="argument">Argument to parse.</param>
        /// <param name="command"></param>
        /// <returns>True if the argument is recognized as a command; otherwise false to allow another extension to process it.</returns>
        bool TryParseCommand(ICommandLineParser parser, string argument, out ICommandLineCommand command);

        /// <summary>
        /// Called after the command-line is parsed.
        /// </summary>
        void PostParse();
    }
}