Table of Contents

Parameters and secrets

Declare task parameters and secrets, then resolve them from arguments, environment variables, user secrets, and workspace configuration.

Entry points

Do.TrailingArguments

Arguments supplied after the -- separator on the task command line.

public static IReadOnlyList<string> TrailingArguments { get; }

Property Value

IReadOnlyList<string>

Do.Param(string)

Declares a command-line parameter and resolves its configured value without executing user code during help discovery.

public static OptionalParam<string> Param(string name)

Parameters

name string

The non-empty configuration key, written as --name value on the command line or DOTNETDO_name in the environment.

Returns

OptionalParam<string>

Do.Param<T>(string)

Declares an optional typed command-line parameter without a default value.

public static OptionalParam<T> Param<T>(string name) where T : notnull

Parameters

name string

The non-empty configuration key, written as --name value on the command line or DOTNETDO_name in the environment.

Returns

OptionalParam<T>

Type Parameters

T

Do.Param<T>(string, T, string?)

Declares a command-line parameter and resolves its configured value without executing user code during help discovery.

public static Param<T> Param<T>(string name, T defaultValue, string? description = null) where T : notnull

Parameters

name string

The non-empty configuration key, written as --name value on the command line or DOTNETDO_name in the environment.

defaultValue T

The value used when command-line arguments, environment variables, and user secrets do not configure the parameter.

description string?

Optional task help text describing the parameter to callers.

Returns

Param<T>

Type Parameters

T

Do.Secret(string, string?, string?)

Declares a string parameter whose resolved value is registered for log redaction.

public static OptionalSecret Secret(string name, string? defaultValue = null, string? description = null)

Parameters

name string

The non-empty configuration key, written as --name value on the command line or DOTNETDO_name in the environment.

defaultValue string?

The secret used when no higher-precedence source configures the parameter; null leaves it optional.

description string?

Optional task help text that must not reveal the secret value.

Returns

OptionalSecret

Related types