--version

This commit is contained in:
Junegunn Choi 2013-12-28 02:25:24 +09:00
parent d7f50b1e41
commit 42d479d071

17
fzf
View File

@ -7,10 +7,11 @@
# / __/ / /_/ __/ # / __/ / /_/ __/
# /_/ /___/_/ Fuzzy finder for your shell # /_/ /___/_/ Fuzzy finder for your shell
# #
# URL: https://github.com/junegunn/fzf # Version: 0.6.1 (December 28, 2013)
#
# Author: Junegunn Choi # Author: Junegunn Choi
# URL: https://github.com/junegunn/fzf
# License: MIT # License: MIT
# Last update: December 20, 2013
# #
# Copyright (c) 2013 Junegunn Choi # Copyright (c) 2013 Junegunn Choi
# #
@ -76,6 +77,7 @@ class FZF
argv = argv.dup argv = argv.dup
while o = argv.shift while o = argv.shift
case o case o
when '--version' then version
when '-h', '--help' then usage 0 when '-h', '--help' then usage 0
when '-m', '--multi' then @multi = true when '-m', '--multi' then @multi = true
when '-x', '--extended' then @xmode = true when '-x', '--extended' then @xmode = true
@ -128,6 +130,17 @@ class FZF
start_loop start_loop
end end
def version
File.open(__FILE__, 'r') do |f|
f.each_line do |line|
if line =~ /Version: (.*)/
$stdout.puts "fzf " << $1
exit
end
end
end
end
def usage x, message = nil def usage x, message = nil
$stderr.puts message if message $stderr.puts message if message
$stderr.puts %[usage: fzf [options] $stderr.puts %[usage: fzf [options]