Package org.syncany.cli
Class InitCommand
- java.lang.Object
-
- org.syncany.cli.Command
-
- org.syncany.cli.AbstractInitCommand
-
- org.syncany.cli.InitCommand
-
- All Implemented Interfaces:
UserInteractionListener
public class InitCommand extends AbstractInitCommand
-
-
Field Summary
Fields Modifier and Type Field Description static int
REPO_ID_LENGTH
-
Fields inherited from class org.syncany.cli.AbstractInitCommand
console, GENERIC_PLUGIN_TYPE_IDENTIFIER, isHeadless, isInteractive, NESTED_OPTIONS_SEPARATOR, OAUTH_TOKEN_WAIT_TIMEOUT, PASSWORD_MIN_LENGTH, PASSWORD_WARN_LENGTH
-
-
Constructor Summary
Constructors Constructor Description InitCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canExecuteInDaemonScope()
Returns whether a command can be run inside the scope of the daemon.int
execute(java.lang.String[] operationArgs)
This method implements the command-specific option-parsing, operation calling and output printing.CommandScope
getRequiredCommandScope()
A command can either be executed within an initialized local directory or in a regular (non-Syncany) directory.InitOperationOptions
parseOptions(java.lang.String[] operationArguments)
A command can typically be configured using command line options.void
printResults(OperationResult operationResult)
A command typically prints a result to the console.-
Methods inherited from class org.syncany.cli.AbstractInitCommand
askPlugin, askPlugin, askRetryConnection, askRetryInvalidSettings, createConfigTO, createTransferSettingsFromOptions, getDefaultDisplayName, getRandomMachineName, onShowMessage, onUserConfirm, onUserNewPassword, onUserPassword, printLink, printTestResult, updateTransferSettings
-
-
-
-
Field Detail
-
REPO_ID_LENGTH
public static final int REPO_ID_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InitCommand
public InitCommand()
-
-
Method Detail
-
getRequiredCommandScope
public CommandScope getRequiredCommandScope()
Description copied from class:Command
A command can either be executed within an initialized local directory or in a regular (non-Syncany) directory. Syncany determines this by searching for a .syncany folder.The required command scope resembles whether or not a command must be executed inside a .syncany directory or not -- or whether it does not matter.
- Specified by:
getRequiredCommandScope
in classCommand
- Returns:
- Returns the required command scope of the command
-
canExecuteInDaemonScope
public boolean canExecuteInDaemonScope()
Description copied from class:Command
Returns whether a command can be run inside the scope of the daemon.If a folder is daemon-managed, the command line client passes the command to the daemon via REST and the daemon executes this command/operation. For some commands, this does not make sense or is dangerous. This method allows certain commands to be daemon-enabled, and other to be daemon-disabled.
- Specified by:
canExecuteInDaemonScope
in classCommand
-
execute
public int execute(java.lang.String[] operationArgs) throws java.lang.Exception
Description copied from class:Command
This method implements the command-specific option-parsing, operation calling and output printing. To do so, the method must read and evaluate the given arguments, prepare a corresponding operation, call it and display the results according to a well-defined format.Implementations should not move any business logic in the execute method (or any other parts of the command).
-
parseOptions
public InitOperationOptions parseOptions(java.lang.String[] operationArguments) throws java.lang.Exception
Description copied from class:Command
A command can typically be configured using command line options. This method parses these command line options and returns anOperationOptions
object representing the options.- Specified by:
parseOptions
in classCommand
- Throws:
java.lang.Exception
-
printResults
public void printResults(OperationResult operationResult)
Description copied from class:Command
A command typically prints a result to the console. This method takes anOperationResult
object and formats it to be human-readable.- Specified by:
printResults
in classCommand
-
-