Skip to content
Myr

Allow "--version" to be used as the argument to --query, --header, et al.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

But why?

authored by Junegunn Choi · committed by Junegunn Choi · parent 475469a · Browse files · 1 file+10 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−2 removed

  • other:+10 added−2 removed

1 file+10 added−2 removed

modified:src/options.go+10 added-2 removed
1740 unmodified lines
1741 theme.Spinner = boldify(theme.Spinner)1742 }1743}17441745func expectsArbitraryString(opt string) bool {1746 switch opt {1747 case "-q", "--query", "-f", "--filter", "--header", "--prompt":1748 return true1749 }1750 return false1751}17521753// ParseOptions parses command-line options1754func ParseOptions() *Options {1755 opts := defaultOptions()17561749 for _, arg := range os.Args[1:] {1750 if arg == "--version" {1757 for idx, arg := range os.Args[1:] {1758 if arg == "--version" && (idx == 0 || idx > 0 && !expectsArbitraryString(os.Args[idx])) {1759 opts.Version = true1760 return opts1761 }1762 }
13 unmodified lines