1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00

Only inform about highlight if it's not installed

This commit is contained in:
Johan Walles 2019-07-15 22:35:19 +02:00
parent a2eca47d54
commit 5139da5d08

12
moar.go
View File

@ -6,6 +6,7 @@ import (
"io"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
@ -30,10 +31,13 @@ func _PrintUsage(output io.Writer) {
flag.PrintDefaults()
// FIXME: Don't print this if highlight is already installed
fmt.Fprintln(output)
fmt.Fprintln(output, "To enable syntax highlighting when viewing source code, install")
fmt.Fprintln(output, "Highlight (http://www.andre-simon.de/zip/download.php).")
_, err := exec.LookPath("highlight")
if err != nil {
// Highlight not installed
fmt.Fprintln(output)
fmt.Fprintln(output, "To enable syntax highlighting when viewing source code, install")
fmt.Fprintln(output, "Highlight (http://www.andre-simon.de/zip/download.php).")
}
moarPath, err := filepath.Abs(os.Args[0])
if err == nil {