Package org.jclouds.scriptbuilder.domain
Class SwitchArg
java.lang.Object
org.jclouds.scriptbuilder.domain.SwitchArg
- All Implemented Interfaces:
AcceptsStatementVisitor
,Statement
Statement used in a shell script
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
OS_TO_SWITCH_PATTERN
-
OS_TO_END_SWITCH_PATTERN
-
OS_TO_CASE_PATTERN
-
-
Constructor Details
-
SwitchArg
Generates a switch statement based onarg
. If its value is found to be a key invalueToActions
, the corresponding action is invoked. Ex. arg is1
- the first argument to the script
and valueToActions is {"start" -> "echo hello", "stop" -> "echo goodbye"}
the script created will respond accordingly:
./script start
invalid input: '<'invalid input: '<' returns hello
./script stop
invalid input: '<'invalid input: '<' returns goodbye- Parameters:
arg
- - shell arg to switch onvalueToActions
- - case statements, if the value of the arg matches a key, the corresponding value will be invoked.
-
-
Method Details
-
render
-
functionDependencies
- Specified by:
functionDependencies
in interfaceStatement
-
hashCode
public int hashCode() -
equals
-
accept
- Specified by:
accept
in interfaceAcceptsStatementVisitor
-