command

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskCmd

type AskCmd struct {
	Prompt []string `arg:"" help:"Natural-language prompt. Multiple tokens are joined with spaces so quoting is optional."`
	Output string   `short:"o" default:"table" enum:"table,json,csv" help:"Output format: table, json, or csv."`
	DryRun bool     `short:"n" help:"Print the generated SQL to stdout and exit without executing. Handy for piping into 'rdq exec --file -'."`
	Quiet  bool     `short:"q" help:"Suppress the '-- Generated SQL:' echo on stderr. Error messages and '(N rows affected)' still go to stderr."`
	Yes    bool     `` /* 159-byte string literal not displayed */
	// contains filtered or unexported fields
}

AskCmd is the Kong struct for `rdq ask`. It turns a natural-language prompt into SQL via Amazon Bedrock and then funnels the generated statement through the same downstream pipeline exec uses (read-only gate → destructive confirmation → Data API → history → render), so a user who flips read-only on in the TUI sees identical behaviour here.

The unexported seams exist so ask_test.go can exercise every branch without hitting AWS. Production callers should never set them.

func (*AskCmd) Run

func (c *AskCmd) Run(globals *Globals) error

Run is the Kong entrypoint. It delegates to runAsk for all real logic so tests can drive the pure function directly and observe exit codes without terminating the test binary via os.Exit.

type ExecCmd

type ExecCmd struct {
	SQL    string `arg:"" optional:"" help:"SQL statement to execute. Mutually exclusive with --file."`
	File   string `short:"f" help:"Read SQL from file path. Use - for stdin."`
	Output string `short:"o" default:"table" enum:"table,json,csv" help:"Output format: table, json, or csv."`
	Yes    bool   `` /* 159-byte string literal not displayed */
	// contains filtered or unexported fields
}

ExecCmd is the Kong struct for `rdq exec`. The stub was replaced with a one-shot runner that reuses the same engine the TUI and GUI talk to.

SQL is optional as a positional arg so users can supply it via --file instead. Mutually exclusive with --file; both empty or both set is a usage error.

The unexported seams (executeSQL, loadState, isTerminal) are intentionally left unexported: they exist only so exec_test.go can exercise every branch without hitting AWS. Production callers should never set them.

func (*ExecCmd) Run

func (c *ExecCmd) Run(globals *Globals) error

Run is the Kong entrypoint. It delegates to runExec for all real logic so tests can drive the pure function directly and observe exit codes without terminating the test binary via os.Exit.

type GUICmd

type GUICmd struct {
	Port   int  `help:"Port to listen on." short:"P" default:"8080"`
	NoOpen bool `help:"Do not open browser automatically."`
	Dev    bool `help:"Allow http://localhost:5173 as an origin so the Vite dev server can talk to this API."`
}

func (*GUICmd) Run

func (c *GUICmd) Run(globals *Globals) error

Run boots the GUI HTTP server with a graceful shutdown on SIGINT / SIGTERM. The globals struct carries any initial connection selection from the CLI layer; the SPA is still expected to call PUT /api/session to pick or confirm a destination.

type Globals

type Globals struct {
	Profile         string
	Debug           bool
	AWSConfig       aws.Config
	ClusterArn      string
	SecretArn       string
	Database        string
	BedrockModel    string
	BedrockLanguage string
}

type TUICmd

type TUICmd struct{}

func (*TUICmd) Run

func (c *TUICmd) Run(globals *Globals) error

Jump to

Keyboard shortcuts

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