aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Extensibility/Data/ICommandLineCommand.cs
blob: b03a18f4f83e3172e511b0cc4f3e5df5540cdc2a (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
// 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.Data
{
    using System.Threading;
    using System.Threading.Tasks;
    using WixToolset.Extensibility.Services;

    /// <summary>
    /// Custom command.
    /// </summary>
    public interface ICommandLineCommand
    {
        /// <summary>
        /// Indicates the command-line should show the command-line logo.
        /// </summary>
        bool ShowLogo { get; }

        /// <summary>
        /// Indicates the command-line parsing can stop.
        /// </summary>
        bool StopParsing { get; }

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>Exit code for the command.</returns>
        Task<int> ExecuteAsync(CancellationToken cancellationToken);

        /// <summary>
        /// Allows the command to parse command-line arguments.
        /// </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); 
    }
}