aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hi.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/hi.go b/hi.go
index 7d3370a..2cb87d5 100644
--- a/hi.go
+++ b/hi.go
@@ -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)