Skip to main content

ICommandLineParser Interface

Provides the command-line arguments.

Methods

MethodDescription
GetArgumentAsFilePathOrError(argument, fileType)Gets the current argument as a file or displays an error.
GetNextArgumentAsDirectoryOrError(argument)Gets the next argument as a directory or displays an error.
GetNextArgumentAsFilePathOrError(argument, filePurpose)Gets the next argument as a file or displays an error.
GetNextArgumentOrError(argument)Gets the next argument or displays error if no argument is available.
IsSwitch(argument)Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity
PeekNextArgument()Looks ahead to the next argument without moving to the next argument.
ReportErrorArgument(argument, message)Reports a command line error for the provided argument.

Properties

PropertyDescription
ErrorArgumentGets the argument that caused the error.

WixToolset.Extensibility.dll version 5.0.1+2f00cbe680fb01ab485d56f16de9cd19b133f875

GetArgumentAsFilePathOrError(argument, fileType) Method

Gets the current argument as a file or displays an error.

Declaration

public string GetArgumentAsFilePathOrError(
string argument,
string fileType
)

Parameters

ParameterTypeDescription
argumentstringCurrent argument used in the error message if necessary.
fileTypestringType of file displayed in the error message if necessary.

Return value

string The fully expanded path if the argument is a file path, otherwise null.

GetNextArgumentAsDirectoryOrError(argument) Method

Gets the next argument as a directory or displays an error.

Declaration

public string GetNextArgumentAsDirectoryOrError(
string argument
)

Parameters

ParameterTypeDescription
argumentstringCurrent argument used in the error message if necessary.

Return value

string The fully expanded path if the argument is a directory, otherwise null.

GetNextArgumentAsFilePathOrError(argument, filePurpose) Method

Gets the next argument as a file or displays an error.

Declaration

public string GetNextArgumentAsFilePathOrError(
string argument,
string filePurpose
)

Parameters

ParameterTypeDescription
argumentstringCurrent argument used in the error message if necessary.
filePurposestringPurpose of the required file.

Return value

string The fully expanded path if the argument is a file path, otherwise null.

GetNextArgumentOrError(argument) Method

Gets the next argument or displays error if no argument is available.

Declaration

public string GetNextArgumentOrError(
string argument
)

Parameters

ParameterTypeDescription
argumentstringCurrent argument used in the error message if necessary.

Return value

string The next argument if present or null

IsSwitch(argument) Method

Validates that a valid switch (starts with "/" or "-"), and returns a bool indicating its validity

Declaration

public bool IsSwitch(
string argument
)

Parameters

ParameterTypeDescription
argumentstringThe string check.

Return value

bool True if a valid switch, otherwise false.

PeekNextArgument() Method

Looks ahead to the next argument without moving to the next argument.

Declaration

public string PeekNextArgument()

Return value

string Next argument if available, otherwise null.

ReportErrorArgument(argument, message) Method

Reports a command line error for the provided argument.

Declaration

public void ReportErrorArgument(
string argument,
WixToolset.Data.Message message
)

Parameters

ParameterTypeDescription
argumentstringArgument that caused the error.
messageWixToolset.Data.MessageMessage to report.

ErrorArgument Property

Gets the argument that caused the error.

Declaration

public string ErrorArgument { get; set; }