bin/fukung in fukung-1.0.0 vs bin/fukung in fukung-1.1.0
- old
+ new
@@ -1,15 +1,41 @@
#! /usr/bin/env ruby
-require 'shellwords'
+Main {
+ argument('tag'){
+ optional true
+ default false
+ }
-begin
- require 'rubygems'
-rescue LoadError
-end
+ option('--launchy', '-l'){
+ description 'open url with launchy gem'
+ default false
+ }
-require 'fukung'
-require 'launchy'
+ def run
+ begin
+ if params['launchy'].given? then
+ Fukung.goto_one( params['tag'].value )
+ else
+ puts Fukung.one( params['tag'].value )
+ end
+ rescue => e
+ $stderr.puts e
+ $stderr.puts e.backtrace if $VERBOSE or Fukung::Debug
+ exit 1
+ end
+ end
+}
-url = Shellwords.escape(Fukung.random)
-Launchy.open(url)
+
+
+BEGIN {
+ begin
+ require 'rubygems'
+ rescue LoadError
+ end
+
+ require 'fukung'
+ require 'main'
+ require 'launchy'
+}