setup

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package setup prepares the shell of a developer: completion for platformgo and the short pgo alias.

The shell configuration gets one block between markers, so running setup again replaces the block and --remove takes it out without touching anything else.

Index

Constants

This section is empty.

Variables

View Source
var Shells = []string{"bash", "fish", "zsh"}

Shells setup knows.

Functions

func Completion

func Completion(shell string, cmds []Command, names ...string) (string, error)

Completion returns the completion script of a shell for the binary and its aliases.

func Detect

func Detect(shellEnv string) (string, error)

Detect returns the shell named by $SHELL.

func ScriptPath

func ScriptPath(o Options) (string, error)

ScriptPath is where the completion script of the shell goes.

Types

type Change

type Change struct {
	Path    string
	Removed bool
}

Change is a file Install wrote or removed.

func Install

func Install(o Options, cmds []Command) ([]Change, error)

Install writes the completion script and hooks it into the shell configuration.

type Command

type Command struct {
	Name    string
	Summary string
	Sub     []string // subcommands, such as create of migrate
	Args    string   // what a positional argument completes to: "dir" or ""
	Flags   []Flag
}

Command is a command of the CLI as completion sees it.

type Flag

type Flag struct {
	Name    string
	Summary string
	Bool    bool
	Dir     bool     // completes to directories
	Values  []string // completes to these values
	List    bool     // Values separated by commas
}

Flag is a flag of a command.

type Options

type Options struct {
	Home   string // home directory
	Config string // XDG_CONFIG_HOME, <home>/.config when empty
	Shell  string
	Alias  bool // add pgo
	Remove bool // take everything out
}

Options of Install.

Jump to

Keyboard shortcuts

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