bashcomp

package module
v0.0.0-...-4c2ce86 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 5

README

bashcomp

Package bashcomp generates a bash completion source file for a command executable.

Example: (this file is in sample1/.)

package main

import (
    "flag"
    "github.com/omakoto/bashcomp"
)

var (
    test = flag.Bool("test", false, "test flag")
    foo  = flag.Bool("foo", false, "test flag 2")
)

func main() {
    bashcomp.HandleBashCompletion()
}

When this program is executed with -bash-completion flag, it prints a bash source file and exits. Source this output line this:

$ . <(testcmd1 -bash-completion)

Then,

$ testcmd1 -[TAB][TAB]

will show

-foo  -test

Documentation

Overview

Package bashcomp generates a bash completion source file for a command executable.

Example: (this file is in sample1/.)

package main

import (
    "flag"
    "github.com/omakoto/bashcomp"
)

var (
    test = flag.Bool("test", false, "test flag")
    foo  = flag.Bool("foo", false, "test flag 2")
)

func main() {
    bashcomp.HandleBashCompletion()
}

When this program is executed with -bash-completion flag, it prints a bash source file and exits. Source this output line this:

$ . <(testcmd1 -bash-completion)

Then,

$ testcmd1 -[TAB][TAB]

will show:

-foo  -test

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBashCompletion

func HandleBashCompletion()

Generate bash completion source file from command line flags for a command. This is for commands that accept file names as arguments.

func HandleBashCompletionNoFiles

func HandleBashCompletionNoFiles(rawArgs ...string)

Generate bash completion source file from command line flags for a command.

This is for commands that take fixed set of strings as arguments, not file names.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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