Skip to content

Amber1990Zhang/nebula-console

 
 

Repository files navigation

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 [-addr ip] [-port port] -u user -p password [-t 120] [-e "nGQL query statement" |  -f file.nGQL]
-h : help
-addr, -address : the Nebula Graph IP/HOST address, default value is 127.0.0.1
-port : the Nebula Graph Port, default value is 3699
-u, -user : the Nebula Graph login user name
-p, -password : the Nebula Graph login password
-t, -timeout : The Nebula Graph client connection timeout in seconds, default value is 120 seconds
-e, -eval : the nGQL directly
-f, -file : 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 ':', (currently "exit" and "quit" which doesn't start with a ':' is also supported for convenience)

Quit from the console

(root@nebula) [nba]> exit
(root@nebula) [nba]> quit
(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

About

Command line interface for the Nebula Graph service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.4%
  • Other 1.6%