Documentation
¶
Overview ¶
Package compflag provides a handful of standard library-compatible flags with bash complition capabilities.
Usage
import "github.com/posener/complete/v2/compflag"
var (
// Define flags...
foo = compflag.String("foo", "", "")
)
func main() {
compflag.Parse("my-program")
// Main function.
}
Alternatively, the library can just be used with the standard library flag package:
import (
"flag"
"github.com/posener/complete/v2/compflag"
)
var (
// Define flags...
foo = compflag.String("foo", "", "")
bar = flag.String("bar", "", "")
)
func main() {
complete.CommandLine("my-program")
flag.ParseArgs()
// Main function.
}
Index ¶
- Variables
- func Bool(name string, value bool, usage string, options ...Option) *bool
- func Int(name string, value int, usage string, options ...Option) *int
- func Parse(name string)
- func String(name string, value string, usage string, options ...Option) *string
- type FlagSet
- func (fs *FlagSet) Bool(name string, value bool, usage string, options ...Option) *bool
- func (fs *FlagSet) Complete(name string)
- func (fs *FlagSet) Int(name string, value int, usage string, options ...Option) *int
- func (fs *FlagSet) Parse(args []string) error
- func (fs *FlagSet) String(name string, value string, usage string, options ...Option) *string
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var CommandLine = (*FlagSet)(flag.CommandLine)
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.