completion

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package completion configures shell completion predictors for the CLI.

Index

Constants

View Source
const (
	ResourceName      = "client:resource_name"
	ProjectName       = "client:project_name"
	PostgresDatabases = "client:postgres_databases"
	MySQLDatabases    = "client:mysql_databases"
)
View Source
const DebugENV = "NCTL_COMPLETION_DEBUG"

DebugENV enables completion diagnostics on stderr.

Predictors have to swallow every error, as anything they return ends up in the candidate list of the shell. Without diagnostics a misconfigured client is indistinguishable from a project holding no resources.

Variables

This section is empty.

Functions

func Command

func Command(ctx context.Context, parser *kong.Kong, log *slog.Logger) (complete.Command, error)

Command builds the complete.Command tree for shell completion. The predictors report to log why they predict nothing.

func NewDebugLogger

func NewDebugLogger(w io.Writer) *slog.Logger

NewDebugLogger returns a logger writing to w why predictors predict nothing.

Every record starts on a new line, because the shell prints it in the middle of the line the user is currently completing.

func Register

func Register(ctx context.Context, parser *kong.Kong, log *slog.Logger) error

Register configures the Kong parser to intercept shell completion requests. The predictors report to log why they predict nothing, see NewDebugLogger.

Types

type Cmd

Cmd generates shell completion scripts.

Jump to

Keyboard shortcuts

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