package
0.0.0-20240903065352-a035e3d95284
Repository: https://github.com/johansteyn/learn.git
Documentation: pkg.go.dev
# README
https://pkg.go.dev/flag https://gobyexample.com/command-line-flags
Build:
% go build -o flags main.go
Usage:
% flags -h % flags --h % flags -help % flags --help
Examples:
- Single hyphens with equals
% go run main.go -name=Bob -age=42 -vaccinated=false
- Double hyphens with equals
% go run main.go --name=Bob --age=42 --vaccinated=false
-
Single hyphens with spaces
% go run main.go -name Bob -age 42
NOTE: Boolean flags cannot use spaces
-
Double hyphens with spaces
% go run main.go --name Bob --age 42