Show help by default

This commit is contained in:
Anton Medvedev 2023-09-14 12:15:25 +02:00
parent 9bc7ab1a3c
commit 6fab9ce2e3
No known key found for this signature in database
2 changed files with 9 additions and 6 deletions

10
help.go
View File

@ -22,11 +22,11 @@ func usage(keyMap KeyMap) string {
curl ... | fx curl ... | fx
%v %v
-h, --help Print help -h, --help print help
-v, --version Print version -v, --version print version
--themes Print themes --themes print themes
-r, --raw Treat input as a raw string -r, --raw treat input as a raw string
-s, --slurp Read all inputs into an array -s, --slurp read all inputs into an array
%v %v
%v %v

View File

@ -73,7 +73,10 @@ func main() {
var fileName string var fileName string
var src io.Reader 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] filePath := args[0]
f, err := os.Open(filePath) f, err := os.Open(filePath)
if err != nil { if err != nil {