completion

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package completion generates shell tab-completion scripts for databricks-* proxy binaries. Scripts are produced from a []FlagDef slice so they stay in sync with the binary's actual flag set — adding a flag to the slice updates completions automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBash

func GenerateBash(binaryName string, flags []FlagDef) string

GenerateBash returns a bash completion script for the given binary and flags.

func GenerateFish

func GenerateFish(binaryName string, flags []FlagDef) string

GenerateFish returns a fish completion script for the given binary and flags.

func GenerateZsh

func GenerateZsh(binaryName string, flags []FlagDef) string

GenerateZsh returns a zsh completion script for the given binary and flags.

func Run

func Run(args []string, flags []FlagDef, binaryName string)

Run handles the positional "completion <shell>" subcommand. Call this as the very first thing in main(), before any flag parsing.

if len(os.Args) >= 2 && os.Args[1] == "completion" {
    completion.Run(os.Args[2:], flagDefs, "databricks-claude")
    os.Exit(0)
}

Types

type FlagDef

type FlagDef struct {
	Name        string // flag name without "--", e.g. "profile"
	Short       string // single-char alias without "-", e.g. "v" (empty = none)
	Description string // human-readable description shown in completions
	TakesArg    bool   // true if the flag consumes the next token as its value
	Completer   string // named completer function (empty = no value completion)

}

FlagDef describes one CLI flag for completion generation.