Skip to main content

Command-Line Interface

The Resoto Shell CLI supports various commands that allow you to access the graph database.

tip

You can pipe commands using | and chain multiple commands using ;.

Commands

CommandDescription
aggregateAggregate this query by the provided specification
ancestorsSelect all ancestors of this node in the graph
certificateCreate TLS certificates
chunkChunk incoming elements in batches
cleanMark all incoming database objects for cleaning
configsManage configuration settings.
countCount incoming elements or sum defined property
descendantsSelect all descendants of this node in the graph
dumpDump all properties of incoming objects
echoSend the provided message to downstream
envRetrieve the environment and pass it to the output stream
flattenTake incoming batches of elements and flattens them to a stream of single elements
formatTransform incoming objects as string with a defined format
headReturn n first elements of the stream
helpShows available commands, as well as help for any specific command
httpPerform HTTP request with incoming data
jobsManage all jobs
jqFilter and process JSON
jsonParse JSON and pass parsed objects to the output stream
kindRetrieves information about the graph data kinds
listTransform incoming objects as string with defined properties
predecessorsSelect all predecessors of this node in the graph
protectMark all incoming database objects as protected
searchSearch the graph
set_desiredAllows to set arbitrary properties as desired for all incoming database objects
set_metadataAllows to set arbitrary properties as metadata for all incoming database objects
sleepSuspend execution for an interval of time
successorsSelect all successor of this node in the graph
systemAccess and manage system wide properties
tagUpdate a tag with provided value or delete a tag
tailReturn n last elements of the stream
templatesAccess the query template library
uniqRemove all duplicated objects from the stream
workflowsManage all workflows
writeWrites 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 command
  • template: 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 call help 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.
Example custom command
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:

Usage of the new hello command
> help hello
# output omitted for brevity
> hello
Hello world.
> hello person="John Doe"
Hello John Doe.
note

Custom commands are defined globally, so they can be executed by any Resoto user.

Placeholder Strings

PlaceholderExample
@DAY@16
@FRIDAY@2022-02-18
@HOUR@15
@MINUTE@23
@MONDAY@2022-02-21
@MONTH@02
@NOW@2022-02-16T15:23:31Z
@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
@UTC@2022-02-16T14:23:31Z
@WEDNESDAY@2022-02-16
@YEAR@2022
@YESTERDAY@2022-02-15