tailscale.comtailscale.com/tempfork/spf13/cobra Index | Files

package cobra

import "tailscale.com/tempfork/spf13/cobra"

Package cobra contains shell scripts and constants copied from https://github.com/spf13/cobra for use in our own shell tab-completion logic.

Index

Constants

const UsageTemplate = "" /* 1235 byte string literal not displayed */

Functions

func ScriptBash

func ScriptBash(w io.Writer, name, compCmd, nameForVar string) error

func ScriptFish

func ScriptFish(w io.Writer, name, compCmd, nameForVar string) error

func ScriptPowershell

func ScriptPowershell(w io.Writer, name, compCmd, nameForVar string) error

func ScriptZsh

func ScriptZsh(w io.Writer, name, compCmd, nameForVar string) error

Types

type ShellCompDirective

type ShellCompDirective int

ShellCompDirective is a bit map representing the different behaviors the shell can be instructed to have once completions have been provided.

const (
	// ShellCompDirectiveError indicates an error occurred and completions should be ignored.
	ShellCompDirectiveError ShellCompDirective = 1 << iota

	// ShellCompDirectiveNoSpace indicates that the shell should not add a space
	// after the completion even if there is a single completion provided.
	ShellCompDirectiveNoSpace

	// ShellCompDirectiveNoFileComp indicates that the shell should not provide
	// file completion even when no completion is provided.
	ShellCompDirectiveNoFileComp

	// ShellCompDirectiveFilterFileExt indicates that the provided completions
	// should be used as file extension filters.
	ShellCompDirectiveFilterFileExt

	// ShellCompDirectiveFilterDirs indicates that only directory names should
	// be provided in file completion.  To request directory names within another
	// directory, the returned completions should specify the directory within
	// which to search.
	ShellCompDirectiveFilterDirs

	// ShellCompDirectiveKeepOrder indicates that the shell should preserve the order
	// in which the completions are provided
	ShellCompDirectiveKeepOrder

	// ShellCompDirectiveDefault indicates to let the shell perform its default
	// behavior after completions have been provided.
	// This one must be last to avoid messing up the iota count.
	ShellCompDirectiveDefault ShellCompDirective = 0
)

func (ShellCompDirective) String

func (d ShellCompDirective) String() string

Returns a string listing the different directive enabled in the specified parameter

Source Files

cobra.go comp.go

Version
v1.84.1 (latest)
Published
May 29, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
1 day ago

Tools for package owners.