Skip to content

CLI & TUI Guide

GoGraph provides a feature-rich and out-of-the-box command-line tool (CLI) that you can use to quickly connect to a local graph database, execute Cypher statements, and view data results in an intuitive table format.

1. Installation

macOS / Linux:

brew install dotnetage/tap/gograph

Method B: Building from Source (For Developers)

Execute the following in the project root directory:

make build
The compiled binary will be located at bin/gograph.

2. Basic Command Structure

The CLI starts in interactive terminal (TUI) mode by default.

gograph [database_path]
  • Running without arguments: Opens default.db and enters interactive mode.
  • Specifying a database path: gograph ./mygraph.db.

Command Mode (Non-Interactive)

If you want to invoke GoGraph in shell scripts, you can use the following subcommands:

2.1 Data Modification (exec)

gograph exec "CREATE (n:Person {name: 'Alice'})"

2.2 Data Query (query)

gograph query "MATCH (n:Person) RETURN n.name"

3. Interactive Terminal Interface (TUI Mode)

The TUI is the best tool for daily debugging and query exploration, providing a REPL (Read-Eval-Print Loop) environment.

3.1 Core Features

  • ASCII Art Banner: Displays version and copyright information on startup.
  • Auto Routing: Directly typing Cypher statements will be automatically recognized and executed.
  • Auto Completion: Press the TAB key to complete keywords.
  • Table Rendering: Query results are presented in a beautiful ASCII table.

3.2 TUI Internal Commands

Command Description
/help Print available command help
/exit Safely exit the TUI
/query <cypher> Force execution in query mode
/exec <cypher> Force execution in mutation mode