From 42d479d0713396c8e34d8e6452381b47bfe15b48 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 28 Dec 2013 02:25:24 +0900 Subject: [PATCH] --version --- fzf | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/fzf b/fzf index d7d899c..e61d613 100755 --- a/fzf +++ b/fzf @@ -7,10 +7,11 @@ # / __/ / /_/ __/ # /_/ /___/_/ Fuzzy finder for your shell # -# URL: https://github.com/junegunn/fzf -# Author: Junegunn Choi -# License: MIT -# Last update: December 20, 2013 +# Version: 0.6.1 (December 28, 2013) +# +# Author: Junegunn Choi +# URL: https://github.com/junegunn/fzf +# License: MIT # # Copyright (c) 2013 Junegunn Choi # @@ -76,6 +77,7 @@ class FZF argv = argv.dup while o = argv.shift case o + when '--version' then version when '-h', '--help' then usage 0 when '-m', '--multi' then @multi = true when '-x', '--extended' then @xmode = true @@ -128,6 +130,17 @@ class FZF start_loop 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 $stderr.puts message if message $stderr.puts %[usage: fzf [options]