commandNotFoundHandler: use stderr and exit code 1

Fixes: #1395
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1397
Approved by: mheon
This commit is contained in:
Valentin Rothberg 2018-09-01 20:17:14 +02:00 committed by Atomic Bot
parent 4a910e1c2b
commit daa28349c8
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"reflect" "reflect"
"regexp" "regexp"
"strings" "strings"
@ -52,7 +53,8 @@ func usageErrorHandler(context *cli.Context, err error, _ bool) error {
} }
func commandNotFoundHandler(context *cli.Context, command string) { func commandNotFoundHandler(context *cli.Context, command string) {
fmt.Fprintf(context.App.Writer, "Command %q not found.\nSee `%s --help`.\n", command, context.App.Name) fmt.Fprintf(os.Stderr, "Command %q not found.\nSee `%s --help`.\n", command, context.App.Name)
os.Exit(1)
} }
// validateFlags searches for StringFlags or StringSlice flags that never had // validateFlags searches for StringFlags or StringSlice flags that never had