Class SshPass


  • public class SshPass
    extends AbstractBinary
    Wrapper for the sshpass binary.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • password

        protected java.lang.String password
      • filename

        protected java.lang.String filename
      • fromEnvVar

        protected boolean fromEnvVar
      • verbose

        protected boolean verbose
    • Constructor Detail

      • SshPass

        public SshPass()
    • Method Detail

      • password

        public SshPass password​(java.lang.String value)
        sshpass option: -p
      • getPassword

        public java.lang.String getPassword()
        sshpass option: -p
      • filename

        public SshPass filename​(java.lang.String value)
        sshpass option: -f
      • getFilename

        public java.lang.String getFilename()
        sshpass option: -f
      • fromEnvVar

        public SshPass fromEnvVar​(boolean value)
        sshpass option: -e
      • getFromEnvVar

        public boolean getFromEnvVar()
        sshpass option: -e
      • verbose

        public SshPass verbose​(boolean value)
        sshpass option: -v
      • getVerbose

        public boolean getVerbose()
        sshpass option: -v
      • outputCommandline

        public SshPass outputCommandline​(boolean value)
        Sets output commandline flag.
        Overrides:
        outputCommandline in class AbstractBinary
        Parameters:
        value - true if to output commandline
        Returns:
        itself
      • options

        public java.util.List<java.lang.String> options()
                                                 throws java.lang.Exception
        Assembles the arguments for the binary.
        Specified by:
        options in class AbstractBinary
        Returns:
        the options
        Throws:
        java.lang.Exception - if failed to determine binary
      • commandLineArgs

        public java.util.List<java.lang.String> commandLineArgs()
                                                         throws java.lang.Exception
        Assembles the full command-line arguments.
        Specified by:
        commandLineArgs in class AbstractBinary
        Returns:
        the command-line arguments
        Throws:
        java.lang.Exception - if failed to determine binary
        See Also:
        options()
      • description

        protected java.lang.String description()
        Returns a short description for the binary.
        Specified by:
        description in class AbstractBinary
        Returns:
        the description
      • getParser

        protected net.sourceforge.argparse4j.inf.ArgumentParser getParser()
        Configures and returns the commandline parser.
        Overrides:
        getParser in class AbstractBinary
        Returns:
        the parser
      • setOptions

        protected boolean setOptions​(net.sourceforge.argparse4j.inf.Namespace ns)
        Sets the parsed options.
        Overrides:
        setOptions in class AbstractBinary
        Parameters:
        ns - the parsed options
        Returns:
        if successfully set
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        For running from the command-line.
        Parameters:
        args - the arguments
        Throws:
        java.lang.Exception