zsh

package
v12.75.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 20

Documentation

Overview

Package zsh provides methods for generating zsh completion

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(info *usage.Info, opts options.Map, name string, fileGlob ...string) string

Generate generates zsh completion code

Example
info := usage.NewInfo()

info.AddCommand("test", "Test data")
info.AddCommand("clean", "Clean data")

info.AddOption("d:dir", "Path to working directory", "dir")

info.BoundOptions("test", "d:dir")
info.BoundOptions("clean", "d:dir")

info.AddOption("nc:no-color", "Disable colors in output")
info.AddOption("h:help", "Show this help message")
info.AddOption("v:version", "Show version")

opts := options.Map{
	"d:dir":       {},
	"nc:no-color": {Type: options.BOOL},
	"h:help":      {Type: options.BOOL},
	"v:version":   {Type: options.BOOL},
}

fmt.Println(Generate(info, opts, "app", "*.txt"))
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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