Nuke.Cola
Loading...
Searching...
No Matches
Nuke.Cola.Tooling.ToolCola Class Reference

Static Public Member Functions

static IReadOnlyCollection< Output > ExecuteWith (this Tool tool, ToolArguments args)
 Execute a tool with the arguments provided by the input record.
 
static ? IReadOnlyCollection< Output > ExecuteWith (this ToolEx tool, ToolExArguments args)
 Execute a tool with standard input with the arguments provided by the input record.
 
static Tool With (this Tool tool, ToolArguments args)
 Set individual Tool launching parameters and propagate the delegate further.
 
static ToolEx With (this ToolEx tool, ToolExArguments args)
 Set individual Tool launching parameters and propagate the delegate further.
 
static ToolEx With (this ToolEx tool, ToolArguments args)
 Set individual Tool launching parameters and propagate the delegate further.
 
static Tool With (this Tool tool, ArgumentStringHandler arguments=default, string? workingDirectory=null, IReadOnlyDictionary< string, string >? environmentVariables=null, int? timeout=null, bool? logOutput=null, bool? logInvocation=null, Action< OutputType, string >? logger=null, Action< IProcess >? exitHandler=null)
 Set individual Tool launching parameters and propagate the delegate further.
 
static ToolEx With (this ToolEx tool, ArgumentStringHandler arguments=default, string? workingDirectory=null, IReadOnlyDictionary< string, string >? environmentVariables=null, int? timeout=null, bool? logOutput=null, bool? logInvocation=null, Action< OutputType, string >? logger=null, Action< IProcess >? exitHandler=null, Action< StreamWriter >? input=null, Encoding? standardOutputEncoding=null, Encoding? standardInputEncoding=null)
 Set individual Tool launching parameters and propagate the delegate further.
 
static ToolArguments SemanticLogging (Func< string, bool >? filter=null, Action< OutputType, string >? normalOutputLogger=null)
 Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.
 
static Tool WithSemanticLogging (this Tool tool, Func< string, bool >? filter=null, Action< OutputType, string >? normalOutputLogger=null)
 Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.
 
static ToolEx WithSemanticLogging (this ToolEx tool, Func< string, bool >? filter=null, Action< OutputType, string >? normalOutputLogger=null)
 Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.
 
static ToolArguments EnvVar (string key, object value, bool includeParentEnvironment=true)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static ToolArguments EnvVars (bool includeParentEnvironment, params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static ToolArguments EnvVars (params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static Tool WithEnvVar (this Tool tool, string key, object value, bool includeParentEnvironment=true)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static Tool WithEnvVars (this Tool tool, bool includeParentEnvironment, params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static Tool WithEnvVars (this Tool tool, params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static Tool WithPathVar (this Tool tool, AbsolutePath path)
 Add an input path to this tool's PATH list. It won't be added if input path is already in there.
 
static ToolEx WithEnvVar (this ToolEx tool, string key, object value, bool includeParentEnvironment=true)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static ToolEx WithEnvVars (this ToolEx tool, params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static ToolEx WithEnvVars (this ToolEx tool, bool includeParentEnvironment, params(string key, object value)[] items)
 A more comfortable passing of environment variables. This will also pass on parent environment.
 
static ToolEx WithPathVar (this ToolEx tool, AbsolutePath path)
 Add an input path to this tool's PATH list. It won't be added if input path is already in there.
 
static IEnumerable< Output > RemoveAnsiEscape (this IEnumerable< Output > toolOutput)
 Removes ANSI escape sequences from the output of a Tool (remove color data for example)
 
static ToolEx Pipe (this IEnumerable< Output > previous, ToolEx next, bool pipeError=false, bool close=true)
 Pipe the results of a tool into the standard input of the next tool. This is not exactly the same as real command line piping, the previous process needs to be finished first to pipe its output into the next one. This however gives the opportunity to transform / filter the output of previous tool with regular LINQ before passing it to the next one.
 
static ToolEx WithInput (this ToolEx tool, IEnumerable< string > lines)
 Provide lines for standard input once the program is run. If the target program waits until end-of-stream queue closing the input stream with CloseInput.
 
static ToolEx WithInput (this ToolEx tool, string line)
 Provide a single line for standard input once the program is run.
 
static ToolEx CloseInput (this ToolEx tool)
 Explicitly close the standard input after other inputs have been queued. Some programs may freeze without this step.
 
static void UpdatePathEnvVar ()
 Attempt to update PATH of this process from user's environment variables.
 
static ValueOrError< Tool > Use (string tool, Action? setup=null)
 Get a tool which should be in PATH, and provide an optional way to set it up automatically if it wasn't.
 
static ValueOrError< Tool > ElseTrySetup (this ValueOrError< Tool > result, bool condition, string tool, Action setup)
 Try a different setup method for a Tool which may failed its installation.
 
static ValueOrError< Tool > ElseTrySetup (this ValueOrError< Tool > result, string tool, Action setup)
 Try a different setup method for a Tool which may failed its installation.
 

Properties

static ToolArguments CurrentEnvironment [get]
 ToolArguments for priming environment variables.
 

Detailed Description

Definition at line 14 of file ToolCola.cs.

Member Function Documentation

◆ CloseInput()

static ToolEx Nuke.Cola.Tooling.ToolCola.CloseInput ( this ToolEx tool)
static

Explicitly close the standard input after other inputs have been queued. Some programs may freeze without this step.

Parameters
tool

◆ ElseTrySetup() [1/2]

static ValueOrError< Tool > Nuke.Cola.Tooling.ToolCola.ElseTrySetup ( this ValueOrError< Tool > result,
bool condition,
string tool,
Action setup )
static

Try a different setup method for a Tool which may failed its installation.

Parameters
resultResult of the previous attempt
conditionOnly attempt this method of setup when condition is met
toolThe name of the tool
setupSetup the tool for the caller
Returns
The Tool or an error if it this or previous setup attempts have failed

◆ ElseTrySetup() [2/2]

static ValueOrError< Tool > Nuke.Cola.Tooling.ToolCola.ElseTrySetup ( this ValueOrError< Tool > result,
string tool,
Action setup )
static

Try a different setup method for a Tool which may failed its installation.

Parameters
resultResult of the previous attempt
toolThe name of the tool
setupSetup the tool for the caller
Returns
The Tool or an error if it this or previous setup attempts have failed

◆ EnvVar()

static ToolArguments Nuke.Cola.Tooling.ToolCola.EnvVar ( string key,
object value,
bool includeParentEnvironment = true )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

Definition at line 275 of file ToolCola.cs.

◆ EnvVars() [1/2]

static ToolArguments Nuke.Cola.Tooling.ToolCola.EnvVars ( bool includeParentEnvironment,
params(string key, object value)[] items )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

Definition at line 288 of file ToolCola.cs.

◆ EnvVars() [2/2]

static ToolArguments Nuke.Cola.Tooling.ToolCola.EnvVars ( params(string key, object value)[] items)
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ ExecuteWith() [1/2]

static IReadOnlyCollection< Output > Nuke.Cola.Tooling.ToolCola.ExecuteWith ( this Tool tool,
ToolArguments args )
static

Execute a tool with the arguments provided by the input record.

Parameters
tool
args

◆ ExecuteWith() [2/2]

static ? IReadOnlyCollection< Output > Nuke.Cola.Tooling.ToolCola.ExecuteWith ( this ToolEx tool,
ToolExArguments args )
static

Execute a tool with standard input with the arguments provided by the input record.

Parameters
tool
args

◆ Pipe()

static ToolEx Nuke.Cola.Tooling.ToolCola.Pipe ( this IEnumerable< Output > previous,
ToolEx next,
bool pipeError = false,
bool close = true )
static

Pipe the results of a tool into the standard input of the next tool. This is not exactly the same as real command line piping, the previous process needs to be finished first to pipe its output into the next one. This however gives the opportunity to transform / filter the output of previous tool with regular LINQ before passing it to the next one.

Parameters
previousThe output of a previous program
nextInitial tool delegate of the next program
pipeErrorAlso pipe standard-error into next program
closeIf this is true, close the input stream after all the lines have been written. This is set to true by default for ease of usage, as most of the time a program's output is the only thing needed to be passed to another program. However if false don't forget to queue closing the input stream with CloseInput.
Returns
A composite ToolEx delegate

◆ RemoveAnsiEscape()

static IEnumerable< Output > Nuke.Cola.Tooling.ToolCola.RemoveAnsiEscape ( this IEnumerable< Output > toolOutput)
static

Removes ANSI escape sequences from the output of a Tool (remove color data for example)

◆ SemanticLogging()

static ToolArguments Nuke.Cola.Tooling.ToolCola.SemanticLogging ( Func< string, bool >? filter = null,
Action< OutputType, string >? normalOutputLogger = null )
static

Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.

Parameters
filter
normalOutputLogger

◆ UpdatePathEnvVar()

static void Nuke.Cola.Tooling.ToolCola.UpdatePathEnvVar ( )
static

Attempt to update PATH of this process from user's environment variables.

Definition at line 423 of file ToolCola.cs.

◆ Use()

static ValueOrError< Tool > Nuke.Cola.Tooling.ToolCola.Use ( string tool,
Action? setup = null )
static

Get a tool which should be in PATH, and provide an optional way to set it up automatically if it wasn't.

Returns
The Tool or an error if it wasn't in PATH and the setup had failed

◆ With() [1/5]

static Tool Nuke.Cola.Tooling.ToolCola.With ( this Tool tool,
ArgumentStringHandler arguments = default,
string? workingDirectory = null,
IReadOnlyDictionary< string, string >? environmentVariables = null,
int? timeout = null,
bool? logOutput = null,
bool? logInvocation = null,
Action< OutputType, string >? logger = null,
Action< IProcess >? exitHandler = null )
static

Set individual Tool launching parameters and propagate the delegate further.

Parameters
tool
arguments
workingDirectory
environmentVariables
timeout
logOutput
logInvocation
logger
exitHandler
  • Arguments will be concatenated
  • Working directory B overrides the one from A but not when B doesn't have one
  • Environmnent variables will be merged
  • TimeOut will be maxed
  • LogOutput is OR-ed
  • LogInvocation is OR-ed
  • Logger / ExitHandler A + B is invoked

◆ With() [2/5]

static Tool Nuke.Cola.Tooling.ToolCola.With ( this Tool tool,
ToolArguments args )
static

Set individual Tool launching parameters and propagate the delegate further.

Parameters
tool
args
  • Arguments will be concatenated
  • Working directory B overrides the one from A but not when B doesn't have one
  • Environmnent variables will be merged
  • TimeOut will be maxed
  • LogOutput is OR-ed
  • LogInvocation is OR-ed
  • Logger / ExitHandler A + B is invoked

◆ With() [3/5]

static ToolEx Nuke.Cola.Tooling.ToolCola.With ( this ToolEx tool,
ArgumentStringHandler arguments = default,
string? workingDirectory = null,
IReadOnlyDictionary< string, string >? environmentVariables = null,
int? timeout = null,
bool? logOutput = null,
bool? logInvocation = null,
Action< OutputType, string >? logger = null,
Action< IProcess >? exitHandler = null,
Action< StreamWriter >? input = null,
Encoding? standardOutputEncoding = null,
Encoding? standardInputEncoding = null )
static

Set individual Tool launching parameters and propagate the delegate further.

Parameters
tool
arguments
workingDirectory
environmentVariables
timeout
logOutput
logInvocation
logger
exitHandler
inputHandle standard input stream after process creation
standardOutputEncodingEncoding for standard output. Default is UTF8 (with BOM)
standardInputEncodingEncoding for standard input. Default is UTF8 (without BOM)
  • Arguments will be concatenated
  • Working directory B overrides the one from A but not when B doesn't have one
  • Environmnent variables will be merged
  • TimeOut will be maxed
  • LogOutput is OR-ed
  • LogInvocation is OR-ed
  • Logger / ExitHandler A + B is invoked
  • Input A + B is invoked
  • Encodings B overrides the one from A but not when B doesn't have one

◆ With() [4/5]

static ToolEx Nuke.Cola.Tooling.ToolCola.With ( this ToolEx tool,
ToolArguments args )
static

Set individual Tool launching parameters and propagate the delegate further.

Parameters
tool
args
  • Arguments will be concatenated
  • Working directory B overrides the one from A but not when B doesn't have one
  • Environmnent variables will be merged
  • TimeOut will be maxed
  • LogOutput is OR-ed
  • LogInvocation is OR-ed
  • Logger / ExitHandler A + B is invoked
  • Input Used from ToolEx arguments
  • Encodings Used from ToolEx arguments

◆ With() [5/5]

static ToolEx Nuke.Cola.Tooling.ToolCola.With ( this ToolEx tool,
ToolExArguments args )
static

Set individual Tool launching parameters and propagate the delegate further.

Parameters
tool
args
  • Arguments will be concatenated
  • Working directory B overrides the one from A but not when B doesn't have one
  • Environmnent variables will be merged
  • TimeOut will be maxed
  • LogOutput is OR-ed
  • LogInvocation is OR-ed
  • Logger / ExitHandler A + B is invoked
  • Input A + B is invoked
  • Encodings B overrides the one from A but not when B doesn't have one

◆ WithEnvVar() [1/2]

static Tool Nuke.Cola.Tooling.ToolCola.WithEnvVar ( this Tool tool,
string key,
object value,
bool includeParentEnvironment = true )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithEnvVar() [2/2]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithEnvVar ( this ToolEx tool,
string key,
object value,
bool includeParentEnvironment = true )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithEnvVars() [1/4]

static Tool Nuke.Cola.Tooling.ToolCola.WithEnvVars ( this Tool tool,
bool includeParentEnvironment,
params(string key, object value)[] items )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithEnvVars() [2/4]

static Tool Nuke.Cola.Tooling.ToolCola.WithEnvVars ( this Tool tool,
params(string key, object value)[] items )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithEnvVars() [3/4]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithEnvVars ( this ToolEx tool,
bool includeParentEnvironment,
params(string key, object value)[] items )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithEnvVars() [4/4]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithEnvVars ( this ToolEx tool,
params(string key, object value)[] items )
static

A more comfortable passing of environment variables. This will also pass on parent environment.

◆ WithInput() [1/2]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithInput ( this ToolEx tool,
IEnumerable< string > lines )
static

Provide lines for standard input once the program is run. If the target program waits until end-of-stream queue closing the input stream with CloseInput.

Parameters
tool
lines

◆ WithInput() [2/2]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithInput ( this ToolEx tool,
string line )
static

Provide a single line for standard input once the program is run.

Parameters
tool
line

◆ WithPathVar() [1/2]

static Tool Nuke.Cola.Tooling.ToolCola.WithPathVar ( this Tool tool,
AbsolutePath path )
static

Add an input path to this tool's PATH list. It won't be added if input path is already in there.

◆ WithPathVar() [2/2]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithPathVar ( this ToolEx tool,
AbsolutePath path )
static

Add an input path to this tool's PATH list. It won't be added if input path is already in there.

◆ WithSemanticLogging() [1/2]

static Tool Nuke.Cola.Tooling.ToolCola.WithSemanticLogging ( this Tool tool,
Func< string, bool >? filter = null,
Action< OutputType, string >? normalOutputLogger = null )
static

Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.

Parameters
tool
filter
normalOutputLogger

◆ WithSemanticLogging() [2/2]

static ToolEx Nuke.Cola.Tooling.ToolCola.WithSemanticLogging ( this ToolEx tool,
Func< string, bool >? filter = null,
Action< OutputType, string >? normalOutputLogger = null )
static

Mark app output Debug/Info/Warning/Error based on its content rather than the stream they were added to.

Parameters
tool
filter
normalOutputLogger

Property Documentation

◆ CurrentEnvironment

ToolArguments Nuke.Cola.Tooling.ToolCola.CurrentEnvironment
staticget

ToolArguments for priming environment variables.

Definition at line 270 of file ToolCola.cs.


The documentation for this class was generated from the following file: