Table of Contents

Class Selection

Namespace
ZeroInstall.Commands.Basic
Assembly
0install.dll

Select a version of the program identified by URI, and compatible versions of all of its dependencies.

public class Selection : CliCommand
Inheritance
Selection
Derived
Inherited Members

Constructors

Selection(ICommandHandler)

Creates a new select command.

public Selection(ICommandHandler handler)

Parameters

handler ICommandHandler

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

Selection(ICommandHandler, bool, bool, bool)

Creates a new select command.

protected Selection(ICommandHandler handler, bool outputOptions = true, bool refreshOptions = true, bool customizeOptions = true)

Parameters

handler ICommandHandler

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

outputOptions bool

Whether to add command-line options controlling output.

refreshOptions bool

Whether to add command-line options controlling refresh behavior.

customizeOptions bool

Whether to add command-line options for customizing selected implementations.

Fields

CustomizeSelections

Indicates the user wants a UI to modify the Selections.

protected bool CustomizeSelections

Field Value

bool

Name

public const string Name = "select"

Field Value

string

Selections

Cached ISolver results.

protected Selections? Selections

Field Value

Selections

SelectionsDocument

Indicates the user provided a pre-computed Selections XML document instead of using the ISolver.

protected bool SelectionsDocument

Field Value

bool

ShowXml

Indicates the user wants a machine-readable output.

protected bool ShowXml

Field Value

bool

Properties

AdditionalArgsMax

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

protected override int AdditionalArgsMax { get; }

Property Value

int

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

Requirements

A set of requirements/restrictions imposed by the user on the implementation selection process as parsed from the command-line arguments.

protected Requirements Requirements { get; }

Property Value

Requirements

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.

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.

RefreshSolve()

Run Solve() with Refresh set to true.

protected void RefreshSolve()

SetInterfaceUri(FeedUri)

Sets InterfaceUri and applies Requirements options that need to be deferred to the end of the parsing process.

protected void SetInterfaceUri(FeedUri uri)

Parameters

uri FeedUri

ShowOutput()

protected virtual ExitCode ShowOutput()

Returns

ExitCode

ShowSelections()

Displays the Selections to the user.

protected void ShowSelections()

Solve()

Runs Solve(Requirements) (unless SelectionsDocument is true) and stores the result in Selections.

protected virtual void Solve()

Exceptions

OperationCanceledException

The user canceled the task.

WebException

A file could not be downloaded from the internet.

IOException

An external application or file required by the solver could not be accessed.

SolverException

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