Command-Line Interface
Commands
The Resoto Shell CLI supports various commands that allow you to access the graph database.
You can pipe commands using |
and chain multiple commands using ;
.
Search Commands
Command | Description |
---|---|
aggregate | Aggregate this query by the provided specification |
ancestors | Select all ancestors of this node in the graph |
count | Count incoming elements or sum defined property |
descendants | Select all descendants of this node in the graph |
history | Search the history of nodes. |
kinds | Retrieves information about the graph data kinds |
predecessors | Select all predecessors of this node in the graph |
search | Search the graph |
successors | Select all successors of this node in the graph |
templates | Access the query template library |
Format Commands
Command | Description |
---|---|
dump | Dump all properties of incoming objects |
format | Transform incoming objects as string with a defined format |
list | Transform incoming objects as string with defined properties |
Action Commands
Command | Description |
---|---|
aws | Execute commands on AWS resources |
clean | Mark all incoming database objects for cleaning |
http | Perform HTTP request with incoming data |
jobs | Manage all jobs |
protect | Mark all incoming database objects as protected |
set_desired | Allows to set arbitrary properties as desired for all incoming database objects |
set_metadata | Allows to set arbitrary properties as metadata for all incoming database objects |
tag | Update a tag with provided value or delete a tag |
workflows | Manage all workflows |
Setup Commands
Command | Description |
---|---|
certificate | Create TLS certificates |
configs | Manage configuration settings |
system | Access and manage system wide properties |
Miscellaneous Commands
Command | Description |
---|---|
apps | Manage infrastructure apps |
chunk | Chunk incoming elements in batches |
echo | Send the provided message to downstream |
env | Retrieve the environment and pass it to the output stream |
flatten | Take incoming batches of elements and flattens them to a stream of single elements |
head | Return n first elements of the stream |
help | Shows available commands, as well as help for any specific command |
jq | Filter and process JSON |
json | Parse JSON and pass parsed objects to the output stream |
sleep | Suspend execution for an interval of time |
tail | Return n last elements of the stream |
uniq | Remove all duplicated objects from the stream |
write | Writes the incoming stream of data to a file in the defined format |
Custom Commands
It is possible to create your own commands by combining existing commands with your own logic. In resoto shell type config edit resoto.core.commands
. This will open a file and show all available custom commands. Resoto ships with an example command called discord
, that allows to send the result of a search to Discord as notification.
A custom command has the following properties:
name
: The name of the custom commandtemplate
: a command template that will be executed when the command is called. A template can have template parameters. See templates to learn how to define them.info
: a short description of the command. This will be displayed to users when they callhelp my-custom-command
parameters
: a list of placeholder parameters. All parameters need to be defined in order to use the command. If the parameter defines a default value, it is considered optional. If there is no default value, the parameter is required and needs to be defined by the user during execution time.
info: 'Say Hi to the user.'
name: 'hello'
parameters:
- name: 'person'
default: 'world'
description: 'The person to greet.'
template: 'echo Hello {{person}}.'
Once a custom command has been defined in the resoto.core.commands
configuration, the command can be executed in Resoto Shell:
> help hello
# output omitted for brevity
> hello
Hello world.
> hello person="John Doe"
Hello John Doe.
Custom commands are defined globally, so they can be executed by any Resoto user.
Placeholder Strings
Placeholders are not case sensitive. You can use @utc@
or @UTC@
and will get the same result.
Placeholder | Example |
---|---|
@UTC@ | 2022-02-16T14:23:31Z |
@NOW@ | 2022-02-16T15:23:31+0200 |
@DAY@ | 16 |
@FRIDAY@ | 2022-02-18 |
@HOUR@ | 15 |
@MINUTE@ | 23 |
@MONDAY@ | 2022-02-21 |
@MONTH@ | 02 |
@SATURDAY@ | 2022-02-19 |
@SECOND@ | 31 |
@SUNDAY@ | 2022-02-20 |
@THURSDAY@ | 2022-02-17 |
@TIME@ | 15:23:31 |
@TODAY@ | 2022-02-16 |
@TOMORROW@ | 2022-02-17 |
@TUESDAY@ | 2022-02-22 |
@TZ@ | CET |
@TZ_OFFSET@ | +0100 |
@WEDNESDAY@ | 2022-02-16 |
@YEAR@ | 2022 |
@YESTERDAY@ | 2022-02-15 |
Keyboard Shortcuts
Resoto Shell supports most common Unix shell keyboard shortcuts.
Shortcut | Description |
---|---|
Ctrl + D on an empty line | Exit the shell (same as quit ) |
Ctrl + L | Clear the entire terminal but not the current line (redraw) |
Ctrl + C | Cancel input for the current line |
Ctrl + U | Clear from cursor to beginning of line |
Ctrl + K | Clear from cursor to end of line |
Ctrl + H | Clear one character to the left of the cursor (same as Backspace) |
Ctrl + D | Clear one character to the right of the cursor |
Esc + Backspace | Clear one word to the left of the cursor |
Esc + D | Clear one word to the right of the cursor |
Alt + ← | Jump to the beginning of the previous word |
Alt + → | Jump to the beginning of the next word |
Ctrl + A | Jump to start of line |
Ctrl + E | Jump to end of line |
Ctrl + R | Reverse search history |
↑ | Step backwards in history |
↓ | Step forward in history |