proxy.golang.org : fuchsia.googlesource.com/third_party/github.com/spf13/pflag.git
Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to the POSIX recommendations for command-line options. See http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html Usage: pflag is a drop-in replacement of Go's native flag package. If you import pflag under the name "flag" then all code should continue to function with no changes. There is one exception to this: if you directly instantiate the Flag struct there is one more field "Shorthand" that you will need to set. Most code never instantiates this struct directly, and instead uses functions such as String(), BoolVar(), and Var(), and is therefore unaffected. Define flags using flag.String(), Bool(), Int(), etc. This declares an integer flag, -flagname, stored in the pointer ip, with type *int. If you like, you can bind the flag to a variable using the Var() functions. Or you can create custom flags that satisfy the Value interface (with pointer receivers) and couple them to flag parsing by For such flags, the default value is just the initial value of the variable. After all flags are defined, call to parse the command line into the defined flags. Flags may then be used directly. If you're using the flags themselves, they are all pointers; if you bind to variables, they're values. After parsing, the arguments after the flag are available as the slice flag.Args() or individually as flag.Arg(i). The arguments are indexed from 0 through flag.NArg()-1. The pflag package also defines some new functions that are not in flag, that give one-letter shorthands for flags. You can use these by appending 'P' to the name of any function that defines a flag. Shorthand letters can be used with single dashes on the command line. Boolean shorthand flags can be combined with other shorthand flags. Command line flag syntax: Unlike the flag package, a single dash before an option means something different than a double dash. Single dashes signify a series of shorthand letters for flags. All but the last shorthand letter must be boolean flags. Flag parsing stops after the terminator "--". Unlike the flag package, flags can be interspersed with arguments anywhere on the command line before this terminator. Integer flags accept 1234, 0664, 0x1234 and may be negative. Boolean flags (in their long form) accept 1, 0, t, f, true, false, TRUE, FALSE, True, False. Duration flags accept any input valid for time.ParseDuration. The default set of command-line flags is controlled by top-level functions. The FlagSet type allows one to define independent sets of flags, such as to implement subcommands in a command-line interface. The methods of FlagSet are analogous to the top-level functions for the command-line flag set.
Registry
-
Source
- Homepage
- Documentation
- JSON
purl: pkg:golang/fuchsia.googlesource.com/third_party/github.com/spf13/pflag.git
License: BSD-3-Clause
Latest release: 4 months ago
First release: almost 8 years ago
Namespace: fuchsia.googlesource.com/third_party/github.com/spf13
Last synced: 8 days ago
fuchsia.googlesource.com/third_party/github.com/googleapis/google-cloud-go.git v0.120.1
Package cloud is the root of the packages used to access Google Cloud Services. See https://godoc...161 versions - Latest release: 18 days ago
fuchsia.googlesource.com/third_party/github.com/fsnotify/fsnotify.git v1.9.0
Package fsnotify provides a platform-independent interface for file system notifications.38 versions - Latest release: 29 days ago
fuchsia.googlesource.com/third_party/github.com/grpc/grpc-go.git v1.71.1
Package grpc implements an RPC system called gRPC. See grpc.io for more information about gRPC.203 versions - Latest release: about 1 month ago
fuchsia.googlesource.com/third_party/github.com/pkg/sftp.git v1.13.9
Package sftp implements the SSH File Transfer Protocol as described in https://tools.ietf.org/htm...20 versions - Latest release: about 1 month ago
fuchsia.googlesource.com/third_party/github.com/protocolbuffers/protobuf-go.git v1.36.6
32 versions - Latest release: about 1 month agofuchsia.googlesource.com/third_party/github.com/google/go-cmp.git v0.7.0
18 versions - Latest release: 4 months agofuchsia.googlesource.com/third_party/github.com/creack/pty.git v1.1.24
Package pty provides functions for working with Unix terminals.25 versions - Latest release: 6 months ago
fuchsia.googlesource.com/third_party/github.com/golang/protobuf.git v1.5.4
22 versions - Latest release: about 1 year agofuchsia.googlesource.com/third_party/github.com/pkg/errors.git v0.9.1
Package errors provides simple error handling primitives. The traditional error handling idiom i...13 versions - Latest release: over 5 years ago
fuchsia.googlesource.com/third_party/github.com/kr/fs.git v0.1.0
Package fs provides filesystem-related functions.1 version - Latest release: almost 7 years ago
fuchsia.googlesource.com/third_party/github.com/go-yaml/yaml.git v2.1.0+incompatible
Package yaml implements YAML support for the Go language. Source code and other details for the ...2 versions - Latest release: about 7 years ago