/nebula-console

Command line interface for the Nebula Graph service

Primary LanguageGoApache License 2.0Apache-2.0

Nebula Graph Console

The console for Nebula Graph 2.0

Build

Install golang by https://golang.org/doc/install, then build with following commands:

$ cd nebula-console
$ make

Usage

./nebula-console [-address ip] [-port port] [-u user] [-p password] [-e "nGQL query statement" |  -f file.nGQL]
-h : help
-address : the Nebula Graph IP address, default value is 127.0.0.1
-port : the Nebula Graph Port, default value is 3699
-u : the Nebula Graph login user name, default value is user
-p : the Nebula Graph login password, default value is password
-e : the nGQL directly
-f : the nGQL script file name

Check options for ./nebula-console -h, try ./nebula-console in interactive mode directly. And try ./nebula-console -e 'show hosts' for the direct script mode. And try ./nebula-console -f demo.nGQL for the script file mode.

Local Command

Nebula-console supports 4 local commands now, which starts with a ':',

Quit from the console

(root@nebula) [nba]> :exit
(root@nebula) [nba]> :quit

Output the query results to a csv file

The query results will be output to both the console and the csv file

(root@nebula) [nba]> :set csv filename.csv

Cancel outputting the query results to the csv file

The query results will only be output to the console

(root@nebula) [nba]> :unset csv

Feature

  • Interactive and non-interactive
  • History
  • Autocompletion
  • Multiple OS and arch supported (linux/amd64 recommend)

Keyboard Shortcuts

Key Binding Description
Ctrl-A, Home Move cursor to beginning of line
Ctrl-E, End Move cursor to end of line
Ctrl-B, Left Move cursor one character left
Ctrl-F, Right Move cursor one character right
Ctrl-Left, Alt-B Move cursor to previous word
Ctrl-Right, Alt-F Move cursor to next word
Ctrl-D, Del (if line is not empty) Delete character under cursor
Ctrl-D (if line is empty) End of File --- quit from the console
Ctrl-C Reset input (create new empty prompt)
Ctrl-L Clear screen (line is unmodified)
Ctrl-T Transpose previous character with current character
Ctrl-H, BackSpace Delete character before cursor
Ctrl-W, Alt-BackSpace Delete word leading up to cursor
Alt-D Delete word following cursor
Ctrl-K Delete from cursor to end of line
Ctrl-U Delete from start of line to cursor
Ctrl-P, Up Previous match from history
Ctrl-N, Down Next match from history
Ctrl-R Reverse Search history (Ctrl-S forward, Ctrl-G cancel)
Ctrl-Y Paste from Yank buffer (Alt-Y to paste next yank instead)
Tab Next completion
Shift-Tab (after Tab) Previous completion

TODO

  • CI/CD
  • package to RPM/DEB/DOCKER
  • batch process to reduce memory consumption and speed up IO