From 6fab9ce2e3121558e9662403c4c659d4135ecb87 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Thu, 14 Sep 2023 12:15:25 +0200 Subject: [PATCH] Show help by default --- help.go | 10 +++++----- main.go | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/help.go b/help.go index 3704156..592c74e 100644 --- a/help.go +++ b/help.go @@ -22,11 +22,11 @@ func usage(keyMap KeyMap) string { curl ... | fx %v - -h, --help Print help - -v, --version Print version - --themes Print themes - -r, --raw Treat input as a raw string - -s, --slurp Read all inputs into an array + -h, --help print help + -v, --version print version + --themes print themes + -r, --raw treat input as a raw string + -s, --slurp read all inputs into an array %v %v diff --git a/main.go b/main.go index 094620e..871f610 100644 --- a/main.go +++ b/main.go @@ -73,7 +73,10 @@ func main() { var fileName string var src io.Reader - if stdinIsTty && len(args) == 1 { + if stdinIsTty && len(args) == 0 { + fmt.Println(usage(keyMap)) + return + } else if stdinIsTty && len(args) == 1 { filePath := args[0] f, err := os.Open(filePath) if err != nil {