mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-17 13:33:49 -07:00
Change exit status (0: OK, 1: No match, 2: Error/Interrupted)
A la grep. Close #345
This commit is contained in:
@@ -180,14 +180,14 @@ func defaultOptions() *Options {
|
||||
Version: false}
|
||||
}
|
||||
|
||||
func help(ok int) {
|
||||
func help(code int) {
|
||||
os.Stderr.WriteString(usage)
|
||||
os.Exit(ok)
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func errorExit(msg string) {
|
||||
os.Stderr.WriteString(msg + "\n")
|
||||
os.Exit(1)
|
||||
os.Exit(exitError)
|
||||
}
|
||||
|
||||
func optString(arg string, prefixes ...string) (bool, string) {
|
||||
@@ -682,7 +682,7 @@ func parseOptions(opts *Options, allArgs []string) {
|
||||
arg := allArgs[i]
|
||||
switch arg {
|
||||
case "-h", "--help":
|
||||
help(0)
|
||||
help(exitOk)
|
||||
case "-x", "--extended":
|
||||
opts.Mode = ModeExtended
|
||||
case "-e", "--extended-exact":
|
||||
|
Reference in New Issue
Block a user