diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-07-04 10:59:28 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-07-04 10:59:28 -0700 |
| commit | de900ec2cdc00e0b4a0602fc6f1a88fd7fc2c5fd (patch) | |
| tree | a83065f8aab2a8a08176902029cb50843727fa02 /hi.go | |
| parent | It's not markdown (diff) | |
| download | hi-de900ec2cdc00e0b4a0602fc6f1a88fd7fc2c5fd.tar.zst | |
Flag placement
Diffstat (limited to 'hi.go')
| -rw-r--r-- | hi.go | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -9,18 +9,6 @@ import ( "strings" ) -func init() { - highlightColor = red - flag.Var((*colorFlag)(&highlightColor), "c", fmt.Sprintf("highlight `color` %s", colorsChoices)) - background = defaultColor - flag.Var((*colorFlag)(&background), "bg", fmt.Sprintf("background `color` default|%s", colorsChoices)) -} - -var ( - highlightColor ansiColor - background ansiColor -) - //go:generate stringer -type=ansiColor -linecomment type ansiColor int @@ -87,6 +75,11 @@ func (c *colorFlag) String() string { return ansiColor(*c).String() } +var ( + highlightColor = red + background = defaultColor +) + func run() error { args := flag.Args() if len(args) == 0 { @@ -132,6 +125,8 @@ Examples: `) os.Exit(2) } + flag.Var((*colorFlag)(&highlightColor), "c", fmt.Sprintf("highlight `color` %s", colorsChoices)) + flag.Var((*colorFlag)(&background), "bg", fmt.Sprintf("background `color` default|%s", colorsChoices)) flag.Parse() if err := run(); err != nil { fmt.Fprintf(os.Stderr, "hi: %s\n", err) |
