5.0
CLI
You can download the binary for your platform by clicking the Download
button below.
Version compatibility between Lenses and CLI is currently supported at the minor
version, e.g. for Lenses 4.2.x
you should download CLI 4.2.y
.
Alternatively, you can run from Docker image:
# Pass credentials explicitly
docker run --rm -it lensesio/lenses-cli lenses-cli \
--host=<host> \
--user=<user> \
--pass=<pass> \
<command>
# Use your existing lenses-cli config file
docker run --rm -it -v $HOME/.lenses:/root/.lenses lensesio/lenses-cli \
lenses-cli \
<command>
Quickstart
To use the CLI you must first configure the workspace.
lenses-cli configure
And fill in the details:
? Host: https://lenseshost:9991
? Auth token or username:
? Password: ******
? Save workspace name: dataopsDev
The configuration will be stored in ~/.lenses/config.yml
Controlling the output format
The —output flag, which controls the format of the output.
The value of output can be Table, YAML or JSON. By default the results of a command are printed as a table.
Additionally, when using –output flag with JSON, two more optional flags are available for use: –pretty and –query. These flags can be passed to all commands that fetch and return JSON-formatted results.
- —pretty - Enable the pretty format for JSON output of commands (default false).
- —query - A jmespath query expression. This allows for querying the JSON output of commands. For more details view the JMESPATH documentation.
Usage with a service account
To use the CLI with a service account for CI/CD you need to pass the following options:
lenses-cli topics --token=<service-account-name>:<service-account-token> --host=<lenses-url-host>
# Real Example
lenses-cli topics --token=ci:58d86476-bcc6-47e2-a57e-0c6bbd9c88b9 --host=http://<your-lenses-url>:9991