PackageCommandBase

Namespace: AnyPackage.Commands.Internal

The base class for package commands.

public abstract class PackageCommandBase : CommandBase, System.Management.Automation.IDynamicParameters

Inheritance Object → InternalCommand → Cmdlet → PSCmdlet → CommandBasePackageCommandBase
Implements IDynamicParameters

Properties

Provider

Gets or sets the package provider.

public abstract string Provider { get; set; }

Property Value

String

Events

public PSEventManager Events { get; }

Property Value

PSEventManager

Host

public PSHost Host { get; }

Property Value

PSHost

InvokeCommand

public CommandInvocationIntrinsics InvokeCommand { get; }

Property Value

CommandInvocationIntrinsics

InvokeProvider

public ProviderIntrinsics InvokeProvider { get; }

Property Value

ProviderIntrinsics

JobManager

public JobManager JobManager { get; }

Property Value

JobManager

JobRepository

public JobRepository JobRepository { get; }

Property Value

JobRepository

MyInvocation

public InvocationInfo MyInvocation { get; }

Property Value

InvocationInfo

PagingParameters

public PagingParameters PagingParameters { get; }

Property Value

PagingParameters

ParameterSetName

public string ParameterSetName { get; }

Property Value

String

SessionState

public SessionState SessionState { get; }

Property Value

SessionState

CommandRuntime

public ICommandRuntime CommandRuntime { get; set; }

Property Value

ICommandRuntime

Stopping

public bool Stopping { get; }

Property Value

Boolean

CommandOrigin

public CommandOrigin CommandOrigin { get; }

Property Value

CommandOrigin

Methods

SetRequest()

Sets the request property.

protected void SetRequest()

SetRequest(String, PackageVersionRange, String, Boolean)

Sets the request property.

protected void SetRequest(string name, PackageVersionRange version, string source, bool trustSource)

Parameters

name String
Specifies the package name.

version PackageVersionRange
Specifies the package version.

source String
Specifies the package source.

trustSource Boolean
Specifies if the source should be trusted.

SetRequest(PackageInfo, Boolean)

Sets the request property.

protected void SetRequest(PackageInfo package, bool trustSource)

Parameters

package PackageInfo
Specifies the package.

trustSource Boolean
Specifies if the source should be trusted.

SetRequest(Uri)

Sets the request property.

protected void SetRequest(Uri uri)

Parameters

uri Uri
Specifies the package uri.

SetPathRequest(String)

Sets the request property.

protected void SetPathRequest(string path)

Parameters

path String
Specifies the path.

GetNameInstances(String)

Gets provider instances.

protected IEnumerable<PackageProvider> GetNameInstances(string name)

Parameters

name String
Name of the provider.

Returns

IEnumerable<PackageProvider>

GetPathInstances(String)

Gets provider instances for a given path.

protected IEnumerable<PackageProvider> GetPathInstances(string path)

Parameters

path String
The path.

Returns

IEnumerable<PackageProvider>

GetUriInstances(Uri)

Get provider instances for a given Uri.

protected IEnumerable<PackageProvider> GetUriInstances(Uri uri)

Parameters

uri Uri
The Uri.

Returns

IEnumerable<PackageProvider>

GetPaths(IEnumerable<String>, Boolean)

Gets normalized paths.

protected IEnumerable<string> GetPaths(IEnumerable<string> paths, bool expandWildcards)

Parameters

paths IEnumerable<String>
The paths to normalize.

expandWildcards Boolean
If wildcards should be expanded.

Returns

IEnumerable<String>

FilterSource(String, IEnumerable<PackageProvider>)

Filters package providers by the source.

protected IEnumerable<PackageProvider> FilterSource(string source, IEnumerable<PackageProvider> providers)

Parameters

source String
The source.

providers IEnumerable<PackageProvider>
The providers.

Returns

IEnumerable<PackageProvider>

ValidateFile(String, ProviderInfo)

Validates that the path is a file.

protected bool ValidateFile(string path, ProviderInfo provider)

Parameters

path String
The path.

provider ProviderInfo
The PS provider.

Returns

Boolean

ValidateOperation(PackageInfo, PackageProviderOperations)

Validates that the package provider supports the operation.

protected bool ValidateOperation(PackageInfo package, PackageProviderOperations operation)

Parameters

package PackageInfo
Package to validate.

operation PackageProviderOperations
Operation to validate.

Returns

Boolean

Invoke(String, String, IDictionary<PackageProvider, InvokePackage>, Boolean, Boolean)

Invokes the package operation on multiple package instances.

protected void Invoke(string package, string verb, IDictionary<PackageProvider, InvokePackage> instances, bool shouldProcess, bool first)

Parameters

package String
The package label.

verb String
The package operation.

instances IDictionary<PackageProvider, InvokePackage>
The package instance and operation.

shouldProcess Boolean
If should call ShouldProcess.

first Boolean
If should only process first provider.