Class DotNetArguments
java.lang.Object
io.jenkins.plugins.dotnet.commands.DotNetArguments
Convenience class for handling the adding of command line arguments, including variable expansions and masking of sensitive
properties.
-
Constructor Summary
ConstructorDescriptionDotNetArguments
(Run<?, ?> run, ArgumentListBuilder cmdLine) Creates a new .NET CLI argument processor. -
Method Summary
Modifier and TypeMethodDescriptionAdds a literal string argument.Adds one or more literal string arguments.Adds a literal string argument, potentially masking it.addFlag
(char flag, boolean set) Optionally adds a flag argument.Optionally adds a flag argument.Adds an option argument.Adds an option argument.Adds an option argument.Adds an option argument.Adds an option argument.addOptions
(char option, String values) Adds option arguments.addOptions
(char option, String values, String delimiter) Adds option arguments.addOptions
(String values) Adds option arguments.addOptions
(String option, String values) Adds option arguments.addPropertyOptions
(String prefix, String propertyString) Adds option arguments based on a Java-style property string.addStringCredential
(String option, String value) Adds an option argument containing a string credential.Applies variable substitution and whitespace trimming to a string.
-
Constructor Details
-
DotNetArguments
Creates a new .NET CLI argument processor.- Parameters:
run
- The execution context.cmdLine
- The underlying argument list builder (expected to be preloaded with the path to thedotnet
executable.
-
-
Method Details
-
add
Adds a literal string argument.- Parameters:
value
- The literal string argument to add.- Returns:
- This .NET CLI argument processor.
-
add
Adds one or more literal string arguments.- Parameters:
values
- The literal string arguments to add.- Returns:
- This .NET CLI argument processor.
-
add
Adds a literal string argument, potentially masking it.- Parameters:
value
- The literal string argument to add.mask
- Indicates whether the argument should be masked.- Returns:
- This .NET CLI argument processor.
-
addFlag
Optionally adds a flag argument.- Parameters:
flag
- The name of the flag (without the--
prefix).set
- Indicates whether the flag should be added.- Returns:
- This .NET CLI argument processor.
-
addFlag
Optionally adds a flag argument.- Parameters:
flag
- The name of the flag (without the-
prefix).set
- Indicates whether the flag should be added.- Returns:
- This .NET CLI argument processor.
-
addOption
Adds an option argument.- Parameters:
value
- The option argument to add; it will have variable substitution applied. If it expands tonull
, no argument is added.- Returns:
- This .NET CLI argument processor.
-
addOption
Adds an option argument.- Parameters:
option
- The name of the option (without the--
prefix).value
- The option argument to add; it will be mapped to"true"
or"false"
. If this isnull
, no argument is added.- Returns:
- This .NET CLI argument processor.
-
addOption
Adds an option argument.- Parameters:
option
- The name of the option (without the--
prefix).value
- The option argument to add; it will be converted to its string representation is base 10. If this isnull
, no argument is added.- Returns:
- This .NET CLI argument processor.
-
addOption
Adds an option argument.- Parameters:
option
- The name of the option (without the--
prefix).value
- The option argument to add; it will have variable substitution applied. If it expands tonull
, no argument is added.- Returns:
- This .NET CLI argument processor.
-
addOption
Adds an option argument.- Parameters:
option
- The name of the option (without the-
prefix or the:
suffix).value
- The option argument to add; it will have variable substitution applied. If it expands tonull
, no argument is added.- Returns:
- This .NET CLI argument processor.
-
addOptions
Adds option arguments.- Parameters:
values
- A string containing option arguments to add; it will have variable substitution applied and will then be tokenized to produce the options. Any parts evaluating tonull
will not be added.- Returns:
- This .NET CLI argument processor.
-
addOptions
Adds option arguments.- Parameters:
option
- The name of the option (without the--
prefix).values
- A string containing option arguments to add; it will have variable substitution applied and will then be tokenized to produce the options. Any parts evaluating tonull
will not be added.- Returns:
- This .NET CLI argument processor.
-
addOptions
Adds option arguments.- Parameters:
option
- The name of the option (without the-
prefix or the:
suffix).values
- A string containing option arguments to add; it will have variable substitution applied and will then be tokenized to produce the options. Any parts evaluating tonull
will not be added.- Returns:
- This .NET CLI argument processor.
-
addOptions
public DotNetArguments addOptions(char option, @CheckForNull String values, @NonNull String delimiter) Adds option arguments.- Parameters:
option
- The name of the option (without the-
prefix or the:
suffix).values
- A string containing option arguments to add; it will have variable substitution applied and will then be tokenized to produce the options. Any parts evaluating tonull
will not be added.delimiter
- The delimiter string to use for tokenization.- Returns:
- This .NET CLI argument processor.
-
addPropertyOptions
public DotNetArguments addPropertyOptions(@NonNull String prefix, @CheckForNull String propertyString) throws IOException Adds option arguments based on a Java-style property string.- Parameters:
prefix
- The prefix to apply to the options.propertyString
- The Java-style property string to process; it will have variable substitution applied.- Returns:
- This .NET CLI argument processor.
- Throws:
IOException
- WhenpropertyString
could not be loaded as a set of properties.
-
addStringCredential
public DotNetArguments addStringCredential(@NonNull String option, @CheckForNull String value) throws AbortException Adds an option argument containing a string credential.- Parameters:
option
- The name of the option (without the--
prefix).value
- The string credential ID; it will have variable substitution applied. If it expands tonull
, no argument is added.- Returns:
- This .NET CLI argument processor.
- Throws:
AbortException
- When no matching string credential could be found.
-
expand
Applies variable substitution and whitespace trimming to a string.- Parameters:
text
- The text to expand.- Returns:
- The expanded form of
text
.
-