repl

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package repl implements the interactive shell: line editing, completion, highlighting, meta commands and query execution with cancellation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration renders a duration coarsely, the way people say it: "43m", "2h 5m".

func ParseMeta

func ParseMeta(line string) (name, arg string, ok bool)

ParseMeta splits a meta command line into the command name and its argument. A trailing semicolon is ignored. ok is false when the line is not a meta command.

Types

type Options

type Options struct {
	Config  *config.Resolved
	Client  *chclient.Client // runs the user's statements
	Auth    auth.Provider
	Meta    *metadata.Cache
	History *history.History // nil disables persistent history
	// HistorySize bounds the in-memory history.
	HistorySize int
	Format      string
	// Pager is the command interactive table output is piped through; empty disables paging.
	Pager string
}

Options wires the shell to the rest of the program.

type REPL

type REPL struct {
	// contains filtered or unexported fields
}

REPL is an interactive session.

func New

func New(opts Options) *REPL

New creates a shell that reads from the terminal and writes to stdout/stderr.

func (*REPL) Run

func (r *REPL) Run()

Run starts the shell and returns when the user leaves it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL