Skip to main content
The Deno 2 Release Candidate is here
Learn more


Logo

An unofficial CLI for SurrealDB

Report Bug · Request Feature

Table of Contents
  1. About
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing

About

This is an early WIP and does not cover even close to all of SurrealDB’s features. I wanted a CLI so i just decided to make one. Suggestions and feedback is appreciated!

Current Features

  • Run a custom query
  • Create, delete and list locally saved queries.
    • Automatically parses query parameters when saving a query and prompts you to enter them when you use your query. NOTE( This is rough at best. )
  • Config file that can be changed from the cli.
  • Query History and history based suggestions ( You can opt out. )
  • List defined database tables as a formatted cli table.

(back to top)

Built With

  • Deno
  • SurrealDB
  • TS

(back to top)

Getting Started

Prerequisites

  • Any Nerd Font

  • deno

    # MacOS/Linux
    curl -fsSL https://deno.land/x/install/install.sh | sh

Installation

  1. Run this in your shell

    deno install -n surrealcli --allow-write --allow-env --allow-net --allow-read https://deno.land/x/surrealcli/mod.ts
  2. Initialize SurrealCLI.

    IMPORTANT! If you set your password during init, it will be stored in plain text in a config file. You can use the SRCLI_PASS Env variable to override the password in the config.

    surrealcli init

    initgif

(back to top)

Usage

  Usage:   surrealcli [subcommand]
  Version: 0.2.0

  Deno: 1.31.2
  Typescript: 4.9.4
  V8: 11.0.226.19

  Description:

    An unofficial Command Line Interface for SurrealDB.
     Made by StelmanJones.

  Options:

    -h, --help                  - Show this help.
    -V, --version               - Show the version number for this program.
    --ns           [namespace]  - Set the namespace
    --db           [database]   - Set the database
    -v, --verbose               - Show entire response objects instead of only results.

  Commands:

    config                      - Commands related to managing the configuration file.
    init                        - Initialize SurrealCLI and create config file.
    tables                      - View all tables in current database.
    query        [sub-command]  - Commands related to running queries.
    completions                 - Generate shell completions.

  Environment variables:

    SRCLI_PASS  <password>  - Overrides password in config file if set.

  Examples:

    Initialize SurrealCLI: surrealcli init

Examples

surrealcli init

init

surrealcli config show / set

config_gif

surrealcli tables

tables

surrealcli query

query

(back to top)

Issues

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don’t forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)