cobra

package
v1.66.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause, Apache-2.0 Imports: 6 Imported by: 0

README

github.com/spf13/cobra

This package contains a copy of the Apache 2.0-licensed shell scripts that Cobra uses to integrate tab-completion into bash, zsh, fish and powershell, and the constants that interface with them. We are re-using these scripts to implement similar tab-completion for ffcli and the standard library flag package.

The shell scripts were Go constants in the Cobra code, but we have extracted them into separate files to facilitate gzipping them, and have removed the activeHelp functionality from them.

Documentation

Overview

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

View Source
const UsageTemplate = `` /* 1233-byte string literal not displayed */

Variables

This section is empty.

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

Jump to

Keyboard shortcuts

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