[ruby] Stub out --expect option

So that it can be used with the recent Vim plugin although extra key
bindings are not available
This commit is contained in:
Junegunn Choi 2015-03-31 15:40:33 +09:00
parent 1c65139888
commit 39d7177bd3

9
fzf
View File

@ -126,6 +126,7 @@ class FZF
@reverse = false @reverse = false
@prompt = '> ' @prompt = '> '
@shr_mtx = Mutex.new @shr_mtx = Mutex.new
@expect = false
@print_query = false @print_query = false
argv = argv =
@ -200,6 +201,11 @@ class FZF
when '--no-print-query' then @print_query = false when '--no-print-query' then @print_query = false
when '-e', '--extended-exact' then @extended = :exact when '-e', '--extended-exact' then @extended = :exact
when '+e', '--no-extended-exact' then @extended = nil when '+e', '--no-extended-exact' then @extended = nil
when '--expect'
argv.shift
@expect = true
when /^--expect=(.*)$/
@expect = true
when '--tac', '--sync' when '--tac', '--sync'
# XXX # XXX
else else
@ -276,10 +282,12 @@ class FZF
if loaded if loaded
if @select1 && len == 1 if @select1 && len == 1
puts @query if @print_query puts @query if @print_query
puts if @expect
burp(empty ? matches.first : matches.first.first) burp(empty ? matches.first : matches.first.first)
exit 0 exit 0
elsif @exit0 && len == 0 elsif @exit0 && len == 0
puts @query if @print_query puts @query if @print_query
puts if @expect
exit 0 exit 0
end end
end end
@ -1153,6 +1161,7 @@ class FZF
C.close_screen C.close_screen
q, selects = geta(:@query, :@selects) q, selects = geta(:@query, :@selects)
@stdout.puts q if @print_query @stdout.puts q if @print_query
@stdout.puts if @expect
if got if got
if selects.empty? if selects.empty?
burp got burp got