Skip to main content

Basic operation of the CLI tool

Hexabase CLI(Command Line Interface) is a developer assistance tool that makes it easier for developers to manipulate Hexabase data. It is published on npm, and anyone can use it freely.

npm

https://www.npmjs.com/package/hexabase-cli

Things to prepare in advance

  • node.js
  • npm

Install

$ npm install -g hexabase-cli

※ If you receive an error when running a CLI tool command, please install the older version using the steps below.

$ npm uninstall -g hexabase-cli
$ npm install -g [email protected]

Update

$ npm update -g hexabase-cli

Usage

$ hx COMMAND
| running command...

$ hx (-v|--version|version)
| hexabase-cli/0.0.2 darwin-x64 node-v14.13.0

$ hx --help [COMMAND]
| USAGE
| $ hx COMMAND

Command list

Please refer here

Environment settings(first time only)

Only for the first time, execute the following environment setting command.

In the CLI, the access destination environment is managed in units called (context).

Set the context with the following command:

$ hx contexts:set [CONTEXT]

ARGUMENTS
| CONTEXT context name

OPTIONS
| -h, --help show CLI help
| --server=server API server, e.g. https://api.hexabase.com
| --sse=sse SSE server, e.g. https://sse.hexabase.com

The following example specifies the production environment and names it "dev."

$ hx contexts:set dev --server=https://api.hexabase.com --sse=https://sse.hexabase.com

Context

Check context

$ hx contexts:get
| NAME  SERVER               SSE
| stg  https://stg-api.hexabase.com   https://stg-sse.hexabase.com

Check multiple contexts

$ hx contexts:get
| NAME  SERVER               SSE
| stg  https://stg-api.hexabase.com   https://stg-sse.hexabase.com
| prod  https://api.hexabase.com    https://sse.hexabase.com

Context switching

$ hx contexts:use stg
| √ Select your current-context · stg
| Current-context successfully set to: stg

Login

$ hx login
| ? Enter your email » [email protected]
| ? Enter your password » xxxxx
| Successfully logged in as: [email protected]

※To log in with Hexabase CLI, you need to obtain a Hexabase user account in advance.

Workspace

Check your workspace

$ hx workspaces:get
| ID NAME
| 5ea81d61a7e3860007bcbe2b workspace_1
| 5e9678e8d4b3e00006eb8745 workspace_2
| 5e1471ac77dc58000633ea84 workspace_3

Select workspace

$ hx workspaces:use 5e1471ac77dc58000633ea84
| Current-workspace set to: workspace_3