Class ScriptCommandLine

  • All Implemented Interfaces:
    CommandLine

    public class ScriptCommandLine
    extends Object
    implements CommandLine
    Quotes command line arguments.
    Since:
    2.0
    Author:
    Erwin Mueller, erwin.mueller@deventm.org
    • Method Detail

      • getExecutable

        public Object getExecutable()
        Description copied from interface: CommandLine
        Returns the executable.
        Specified by:
        getExecutable in interface CommandLine
        Returns:
        the Object executable to run, can be the name of the executable or the path or any other abstract object.
      • add

        public CommandLine add​(boolean quote,
                               Object... arguments)
        Description copied from interface: CommandLine
        Adds the specified command line arguments.
        Specified by:
        add in interface CommandLine
        Parameters:
        quote - set to true to quote the argument.
        arguments - the Object array arguments.
        Returns:
        this DefaultCommandLine.
      • add

        public CommandLine add​(boolean quote,
                               Object argument)
        Description copied from interface: CommandLine
        Adds the specified command line argument. If the quote arguments is set then the arguments is quoted in double/single quotes.
        • aaa -> aaa
        • aaa bbb -> "aaa bbb"
        • "aaa" bbb -> '"aaa" bbb'
        • "aaa ccc" bbb -> '"aaa ccc" bbb'
        • "aaa"bbb -> '"aaa"bbb'
        Specified by:
        add in interface CommandLine
        Parameters:
        quote - set to true to quote the argument.
        argument - the Object argument.
        Returns:
        this DefaultCommandLine.
      • addSub

        public CommandLine addSub​(String name,
                                  Object value)
        Description copied from interface: CommandLine
        Adds a variable substitution for the arguments. The variables are only substituted when the arguments are returned. The variables must be enclosed in the enclose "<", ">", for example: "foo=<bar>".
        Specified by:
        addSub in interface CommandLine
        Parameters:
        name - the String name of the variable.
        value - the Object value of the variable.
        Returns:
        this DefaultCommandLine.
      • setWorkingDir

        public void setWorkingDir​(File dir)
        Description copied from interface: CommandLine
        Sets the working directory.
        Specified by:
        setWorkingDir in interface CommandLine
        Parameters:
        dir - the File directory or null to use the working directory of the current Java process.
      • getWorkingDir

        public File getWorkingDir()
        Description copied from interface: CommandLine
        Returns the working directory.
        Specified by:
        getWorkingDir in interface CommandLine
        Returns:
        the File directory or null to use the working directory of the current Java process.
      • setVariableStartChar

        public void setVariableStartChar​(char character)
        Description copied from interface: CommandLine
        Sets the variable substitution start character. The start character defaults to "<".
        Specified by:
        setVariableStartChar in interface CommandLine
        Parameters:
        character - the character.
      • setVariableStopChar

        public void setVariableStopChar​(char character)
        Description copied from interface: CommandLine
        Sets the variable substitution stop character. The stop character defaults to ">".
        Specified by:
        setVariableStopChar in interface CommandLine
        Parameters:
        character - the character.
      • getTemplate

        public com.anrisoftware.resources.templates.external.TemplateResource getTemplate()