diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-07-04 10:47:24 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-07-04 10:47:24 -0700 |
| commit | 1d9f7d2fe88deecf958e0199b9d669328a717c17 (patch) | |
| tree | 9c4f36d57d383be1425f58ab92b1f4f5f64fcf58 /hi.go | |
| parent | b0454e1de6ff0cf310b3acb599a7d42d7a079423 (diff) | |
| download | hi-1d9f7d2fe88deecf958e0199b9d669328a717c17.tar.zst | |
Better documentation
Diffstat (limited to 'hi.go')
| -rw-r--r-- | hi.go | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -90,16 +90,16 @@ func (c *colorFlag) String() string { func run() error { args := flag.Args() if len(args) == 0 { - fmt.Fprintf(os.Stderr, "missing regexp to highlight\n") + fmt.Fprintf(os.Stderr, "hi: missing regexp to highlight\n") flag.Usage() } if len(args) > 2 { - fmt.Fprintf(os.Stderr, "too many positional arguments\n") + fmt.Fprintf(os.Stderr, "hi: too many positional arguments\n") flag.Usage() } highlightRE, err := regexp.CompilePOSIX(args[0]) if err != nil { - return fmt.Errorf("invalid highlight regexp: %s", err) + return fmt.Errorf("invalid highlight regexp: %s\n", err) } foregroundColor := highlightColor.Foreground() backgroundColor := background.Background() @@ -119,8 +119,17 @@ func run() error { func main() { flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: hi [OPTIONS] REGEXP\n") + fmt.Fprintf(os.Stderr, `Usage: hi [OPTION]... REGEXP +Highlight lines from standard input using the given regexp. + +`) flag.PrintDefaults() + fmt.Fprintf(os.Stderr, ` +Examples: + echo 1\n2\n3 | hi ^2 + + journalctl | hi -bg cyan (E|e)rror | less +`) os.Exit(2) } flag.Parse() |
