-
Notifications
You must be signed in to change notification settings - Fork 11
Adding CRaSH commands
CRaSH is the embedded shell we use. Commands in CRaSH are currently groovy scripts. This might change in next versions of CRaSH, though.
Commands are placed in mgmt/crash/src/main/resources/crash/commands/cloudius
.
A command can be a simple groovy script or a class. We prefer using classes because we can add more metadata to them (i.e. description, help, man, etc.).
To learn how to write a command, please see http://www.crashub.org/reference.html#d5e519.
- Besides the
out
variable which exists in the command context, there's also theunmatched
variable as well. This variable contains all of the unmatched arguments from the command line.
This class was created to provide shared functionality between commands. It contains methods to help with argument completion, "daemonization" and simple output column formatting.
CRaSH executes this script for each session. This is where the prompt is configured, where we simulate a "current working directory". All variables defined in this file will be available for commands. For example, getResolvedPath(somepath) Will return the correct resolved path, relative to the current working directory.