Package com.github.fracpete.rsync4j
Class SshPass
- java.lang.Object
-
- com.github.fracpete.rsync4j.core.AbstractBinary
-
- com.github.fracpete.rsync4j.SshPass
-
public class SshPass extends AbstractBinary
Wrapper for the sshpass binary.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringfilenameprotected booleanfromEnvVarprotected java.lang.Stringpasswordprotected booleanverbose-
Fields inherited from class com.github.fracpete.rsync4j.core.AbstractBinary
logger, outputCommandline, outputSingleCommandline
-
-
Constructor Summary
Constructors Constructor Description SshPass()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>commandLineArgs()Assembles the full command-line arguments.protected java.lang.Stringdescription()Returns a short description for the binary.SshPassfilename(java.lang.String value)sshpass option: -fSshPassfromEnvVar(boolean value)sshpass option: -ejava.lang.StringgetFilename()sshpass option: -fbooleangetFromEnvVar()sshpass option: -eprotected net.sourceforge.argparse4j.inf.ArgumentParsergetParser()Configures and returns the commandline parser.java.lang.StringgetPassword()sshpass option: -pbooleangetVerbose()sshpass option: -vstatic voidmain(java.lang.String[] args)For running from the command-line.java.util.List<java.lang.String>options()Assembles the arguments for the binary.SshPassoutputCommandline(boolean value)Sets output commandline flag.SshPasspassword(java.lang.String value)sshpass option: -pvoidreset()Resets the members.protected booleansetOptions(net.sourceforge.argparse4j.inf.Namespace ns)Sets the parsed options.SshPassverbose(boolean value)sshpass option: -v-
Methods inherited from class com.github.fracpete.rsync4j.core.AbstractBinary
builder, commandLine, execute, getOutputCommandline, getOutputSingleCommandline, outputSingleCommandline, run, setOptions, start
-
-
-
-
Method Detail
-
reset
public void reset()
Resets the members.- Overrides:
resetin classAbstractBinary
-
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:
outputCommandlinein classAbstractBinary- Parameters:
value- true if to output commandline- Returns:
- itself
-
options
public java.util.List<java.lang.String> options() throws java.lang.ExceptionAssembles the arguments for the binary.- Specified by:
optionsin classAbstractBinary- Returns:
- the options
- Throws:
java.lang.Exception- if failed to determine binary
-
commandLineArgs
public java.util.List<java.lang.String> commandLineArgs() throws java.lang.ExceptionAssembles the full command-line arguments.- Specified by:
commandLineArgsin classAbstractBinary- 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:
descriptionin classAbstractBinary- Returns:
- the description
-
getParser
protected net.sourceforge.argparse4j.inf.ArgumentParser getParser()
Configures and returns the commandline parser.- Overrides:
getParserin classAbstractBinary- Returns:
- the parser
-
setOptions
protected boolean setOptions(net.sourceforge.argparse4j.inf.Namespace ns)
Sets the parsed options.- Overrides:
setOptionsin classAbstractBinary- Parameters:
ns- the parsed options- Returns:
- if successfully set
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionFor running from the command-line.- Parameters:
args- the arguments- Throws:
java.lang.Exception
-
-