Class DotNetArguments

java.lang.Object
io.jenkins.plugins.dotnet.commands.DotNetArguments

public final class DotNetArguments extends Object
Convenience class for handling the adding of command line arguments, including variable expansions and masking of sensitive properties.
  • Constructor Details

    • DotNetArguments

      public DotNetArguments(@NonNull Run<?,?> run, @NonNull ArgumentListBuilder cmdLine)
      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 the dotnet executable.
  • Method Details

    • add

      public DotNetArguments add(@NonNull String value)
      Adds a literal string argument.
      Parameters:
      value - The literal string argument to add.
      Returns:
      This .NET CLI argument processor.
    • add

      public DotNetArguments add(@NonNull String... values)
      Adds one or more literal string arguments.
      Parameters:
      values - The literal string arguments to add.
      Returns:
      This .NET CLI argument processor.
    • add

      public DotNetArguments add(@NonNull String value, boolean mask)
      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

      public DotNetArguments addFlag(@NonNull String flag, boolean set)
      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

      public DotNetArguments addFlag(char flag, boolean set)
      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

      public DotNetArguments addOption(@CheckForNull String value)
      Adds an option argument.
      Parameters:
      value - The option argument to add; it will have variable substitution applied. If it expands to null, no argument is added.
      Returns:
      This .NET CLI argument processor.
    • addOption

      public DotNetArguments addOption(@NonNull String option, @CheckForNull Boolean value)
      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 is null, no argument is added.
      Returns:
      This .NET CLI argument processor.
    • addOption

      public DotNetArguments addOption(@NonNull String option, @CheckForNull Integer value)
      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 is null, no argument is added.
      Returns:
      This .NET CLI argument processor.
    • addOption

      public DotNetArguments addOption(@NonNull String option, @CheckForNull String value)
      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 to null, no argument is added.
      Returns:
      This .NET CLI argument processor.
    • addOption

      public DotNetArguments addOption(char option, @CheckForNull String value)
      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 to null, no argument is added.
      Returns:
      This .NET CLI argument processor.
    • addOptions

      public DotNetArguments addOptions(@CheckForNull String values)
      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 to null will not be added.
      Returns:
      This .NET CLI argument processor.
    • addOptions

      public DotNetArguments addOptions(@NonNull String option, @CheckForNull String values)
      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 to null will not be added.
      Returns:
      This .NET CLI argument processor.
    • addOptions

      public DotNetArguments addOptions(char option, @CheckForNull String values)
      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 to null 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 to null 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 - When propertyString 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 to null, no argument is added.
      Returns:
      This .NET CLI argument processor.
      Throws:
      AbortException - When no matching string credential could be found.
    • expand

      public String expand(@CheckForNull String text)
      Applies variable substitution and whitespace trimming to a string.
      Parameters:
      text - The text to expand.
      Returns:
      The expanded form of text.