mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 21:05:09 +00:00
Allow "--version" to be used as the argument to --query, --header, et al.
But why?
This commit is contained in:
parent
475469a2e7
commit
bbbcd780c9
@ -1742,12 +1742,20 @@ func postProcessOptions(opts *Options) {
|
||||
}
|
||||
}
|
||||
|
||||
func expectsArbitraryString(opt string) bool {
|
||||
switch opt {
|
||||
case "-q", "--query", "-f", "--filter", "--header", "--prompt":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ParseOptions parses command-line options
|
||||
func ParseOptions() *Options {
|
||||
opts := defaultOptions()
|
||||
|
||||
for _, arg := range os.Args[1:] {
|
||||
if arg == "--version" {
|
||||
for idx, arg := range os.Args[1:] {
|
||||
if arg == "--version" && (idx == 0 || idx > 0 && !expectsArbitraryString(os.Args[idx])) {
|
||||
opts.Version = true
|
||||
return opts
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user