CakeTaskBuilderExtensions.

DescriptionFromArguments<T>(CakeTaskBuilder, string) Method

Summary

Sets the Task's description with the output generated from GetDescription<T>(string). That is, a description of each of the arguments a task takes in. Note, calling Description or this function again will overwrite what was there before.

Syntax

public static CakeTaskBuilder DescriptionFromArguments<T>(this CakeTaskBuilder builder, string taskDescription)

Examples

If cake --showdescription is passed in, this will print information about all the arguments for a task.

public class MyConfig
    {
        [BooleanArgument(
            "dry_run",
            Description = "Set to 'true' to not do anything.",
            DefaultValue = false
        )]
        public bool DryRun { get; set; }
    }
    
    Task( "my_task" )
    .Does(
        () =>
        {
            Information( "Hello" );
        }
    ).DescriptionFromArguments( "Does my thing" );
    
    // Output of cake --showdescription will be:
    // 
    // my_task              Does my thing
    // - Arguments:
    //      -- dry_run
    //          Set to 'true' to not do anything.
    //          Type: Boolean.
    //          Default Value: 'False'.
    //          Value is Secret: False.

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute
CakeNamespaceImportAttribute

Type Parameters

Name Description
T The class that has arguments binded to that we wish to get the description of.

Parameters

Name Type Description
builder CakeTaskBuilder
taskDescription string Top-level description of the task.

Return Value

Type Description
CakeTaskBuilder A CakeTaskBuilder to continue being built up.