Table of Contents

Class CliMultiCommand

Namespace
ZeroInstall.Commands
Assembly
0install.dll

Common base class for commands that provide multiple sub-CliCommands.

public abstract class CliMultiCommand : CliCommand
Inheritance
CliMultiCommand
Derived
Inherited Members

Constructors

CliMultiCommand(ICommandHandler)

Creates a new command.

protected CliMultiCommand(ICommandHandler handler)

Parameters

handler ICommandHandler

A callback object used when the user needs to be asked questions or informed about download and IO tasks.

Properties

AdditionalArgsMin

The minimum number of AdditionalArgs allowed. Checked in Parse(IReadOnlyList<string>).

protected override int AdditionalArgsMin { get; }

Property Value

int

Description

A short description of what this command does.

public override string Description { get; }

Property Value

string

SubCommandNames

A list of sub-command names (without alternatives) as used in command-line arguments in lower-case.

public abstract IEnumerable<string> SubCommandNames { get; }

Property Value

IEnumerable<string>

Usage

The additional arguments to be displayed after the command name in the help text.

public override string Usage { get; }

Property Value

string

Methods

Execute()

Executes the commands specified by the command-line arguments. Must call Parse(IReadOnlyList<string>) first!

public override ExitCode Execute()

Returns

ExitCode

The exit status code to end the process with.

Remarks

When inheriting this method is usually replaced.

Exceptions

OperationCanceledException

The user canceled the task.

OptionException

The number of arguments passed in on the command-line is incorrect.

WebException

A file could not be downloaded from the internet.

NotSupportedException

A file format, protocol, etc. is unknown or not supported.

IOException

A downloaded file could not be written to the disk or extracted or an external application or file required by the solver could not be accessed.

UnauthorizedAccessException

An operation failed due to insufficient rights.

InvalidDataException

A problem occurred while deserializing an XML file.

SignatureException

The signature data could not be handled for some reason.

FormatException

An URI, local path, version number, etc. is invalid.

DigestMismatchException

An Implementation's Archives don't match the associated ManifestDigest.

SolverException

The ISolver was unable to provide Selections that fulfill the Requirements.

ImplementationNotFoundException

One of the ImplementationBases is not cached yet.

ExecutorException

The IExecutor was unable to process the Selections.

GetCommand(string)

Creates a new sub-CliCommand based on a name.

public abstract CliCommand GetCommand(string commandName)

Parameters

commandName string

The command name to look for; case-insensitive.

Returns

CliCommand

The requested sub-CliCommand.

Exceptions

OptionException

commandName is an unknown command.

IOException

There was a problem accessing a configuration file or one of the stores.

UnauthorizedAccessException

Access to a configuration file or one of the stores was not permitted.

InvalidDataException

A configuration file is damaged.

Parse(IReadOnlyList<string>)

Parses command-line arguments and stores the result in the command.

public override void Parse(IReadOnlyList<string> args)

Parameters

args IReadOnlyList<string>

The command-line arguments to be parsed.

Exceptions

OperationCanceledException

The user asked to see help information, version information, etc..

OptionException

args contains unknown options.

IOException

An IO operation failed.

UnauthorizedAccessException

More privileges are required.

UriFormatException

The URI or local path specified is invalid.