Documentation
¶
Overview ¶
Package xflag provides a set of functions and utilities to extend the functionality of Go'give flag package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶ added in v0.11.0
type Metadata struct { // Name is the name of the application. Name string // Description is a short description of the application. Description string // Ver is the version of the application. Ver string // Synopsis is the command usage pattern shown in the usage section. Defaults to "[global options]" if empty. Synopsis string // Options is a list of options for the application. Options []Option }
Metadata represents metadata for a command-line application.
func (*Metadata) Usage ¶ added in v0.11.0
Usage returns the formatted usage information for the application.
The returned string contains the following sections:
- NAME: Application name and brief description.
- USAGE: Command-line usage pattern with global options.
- VERSION: Current version of the application.
- GLOBAL OPTIONS: Available command-line options with their details and default values.
type Option ¶ added in v0.11.0
type Option struct { // Name is the name of the option. Name string // Shorthand is a single-character shorthand for the option. Shorthand string // Type is the type of value the option accepts (e.g., "FILE", "DIRECTORY"). Type string // Description is a short description of the option. Description string // Default is the default value for the option. Default string }
Option represents a single command-line option.
type StringSlice ¶
type StringSlice []string
StringSlice is a custom flag type that allows for repeated string flags.
func (*StringSlice) Set ¶
func (s *StringSlice) Set(value string) error
Set satisfies the flag.Value interface.
func (*StringSlice) String ¶
func (s *StringSlice) String() string
String satisfies the flag.Value interface.
Click to show internal directories.
Click to hide internal directories.