From b86e235ef4f9423624fc93e1c417484e938245df Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 15:03:23 -0700 Subject: Re-organize command-line processing and add support for custom commands --- .../Services/ICommandLineParser.cs | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src/WixToolset.Extensibility/Services/ICommandLineParser.cs') diff --git a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs index 60507c6c..f7e2a28f 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineParser.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineParser.cs @@ -1,15 +1,36 @@ -// 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. +// 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.Services { - using WixToolset.Extensibility.Data; + using System.Collections.Generic; public interface ICommandLineParser { - IExtensionManager ExtensionManager { get; set; } + string ErrorArgument { get; set; } - ICommandLineArguments Arguments { get; set; } + /// + /// Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity + /// + /// The string check. + /// True if a valid switch, otherwise false. + bool IsSwitch(string arg); - ICommandLineCommand ParseStandardCommandLine(); + string GetArgumentAsFilePathOrError(string argument, string fileType); + + void GetArgumentAsFilePathOrError(string argument, string fileType, IList paths); + + string GetNextArgumentOrError(string commandLineSwitch); + + bool GetNextArgumentOrError(string commandLineSwitch, IList argument); + + string GetNextArgumentAsDirectoryOrError(string commandLineSwitch); + + bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList directories); + + string GetNextArgumentAsFilePathOrError(string commandLineSwitch); + + bool GetNextArgumentAsFilePathOrError(string commandLineSwitch, string fileType, IList paths); + + bool TryGetNextSwitchOrArgument(out string arg); } } -- cgit v1.2.3-55-g6feb