CommandAliases.

Command(ICakeContext, CommandSettings, ProcessArgumentBuilder) Method

Summary

Executes a generic command based on arguments and settings.
Namespace
Cake.Common.Tools.Command
Containing Type
CommandAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Command")]
public static void Command(this ICakeContext context, CommandSettings settings, ProcessArgumentBuilder arguments = null)

Examples

 #tool dotnet:?package=DPI&version=2022.8.21.54
 // Reusable tools settings i.e. created in setup.
 var settings = new CommandSettings {
         ToolName = "DPI",
         ToolExecutableNames =  new []{ "dpi", "dpi.exe"},
      };

 // Example with ProcessArgumentBuilder
 Command(
     settings,
     new ProcessArgumentBuilder()
          .Append("nuget")
          .AppendQuoted(Context.Environment.WorkingDirectory.FullPath)
          .AppendSwitch("--output", " ", "TABLE")
          .Append("analyze")
 );

 // Example with implicit ProcessArgumentBuilder
 Command(
      settings,
      $"nuget --output TABLE analyze"
 );

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
CakeAliasCategoryAttribute An attribute used for documentation of alias methods/properties.

Parameters

Name Type Description
context ICakeContext The context.
settings CommandSettings The settings.
arguments ProcessArgumentBuilder The optional arguments.

Return Value

Type Description
void