Lever CLI

This page will introduce you to the lever CLI tool

The lever command is the official command-line interface for Lever. It can be used to manage Lever and even to invoke Lever methods.

Prerequisites

  • Either Go or Docker.
  • Make
  • Linux or Mac (Windows should work too but it was never tested)

Installation

$ git clone https://github.com/leveros/leveros
$ cd leveros
$ make cli
$ sudo make install-cli

🔧 Command: lever

lever [global options] subcommand [command options] [arguments...]

  • #️⃣ Option: --env, -E "dev.lever" - The name of the environment to act on. [$LEVEROS_ENV].
  • #️⃣ Option: --host, -H - The address to direct the client to, if different from env name. The CLI attempts to auto-detect the host when the env name ends with .lever, as it is assumed that a local installation is trying to be contacted. [$LEVEROS_IP_PORT].
  • #️⃣ Option: --help, -h - Show help.
  • #️⃣ Option: --version, -v - Show version information.

Command line interface for Lever OS.

➡️ Subcommand: lever deploy [command options] [<dir>]

  • #️⃣ Option: --admin "admin.lever" - The admin environment to call.

Where

  • <dir> is the directory to deploy. If not specified, it defaults to ., the current directory.

Deploy a directory as a Lever service onto the environment specified by the global option --env. This command archives the directory with all of its contents and uploads it to Lever. The directory must contain a valid lever.json specifying the configuration for the service.

➡️ Subcommand: lever invoke [command options] <url> [jsonargs...]

  • #️⃣ Option: --pretty - Pretty print the JSON reply. No effect if the reply is of type bytes.

Where

  • <url> is the Lever URL to invoke. This can be either absolute (eg lever://<env>/<service>/[<resource>/]<method>) or relative (eg /<service>/[<resource>/]<method>), in which case the environment set by --env is used.
  • jsonargs... are the JSON arguments of the method invokation. Please use proper JSON for the args; this includes the quotes for strings (eg in bash '"a string"'). If the first jsonarg is --, then args are assumed of type bytes and are read from standard input.

Invoke a Lever method with provided args.

➡️ Subcommand: lever stream [command options] <url> [jsonargs...]

  • #️⃣ Option: --bytes - Stdin will be interpreted as byte chunks rather than JSON.
  • #️⃣ Option: --pretty - Pretty print the JSON reply. No effect if the reply is of type bytes.

Where

  • <url> is the Lever URL of the streaming method to invoke. This can be either absolute (eg lever://<env>/<service>/[<resource>/]<method>) or relative (eg /<service>/[<resource>/]<method>), in which case the environment set by --env is used.
  • jsonargs... are the JSON arguments of the method invokation. Please use proper JSON for the args; this includes the quotes for strings (eg in bash '"a string"').

Invoke a Lever streaming method with provided args. The stream communication takes place via standard I/O. While it is possible for the stream itself to be of type bytes, this command does not allow for the args of the invokation to be of type bytes.