Benoit Caccinolo ============================================= Here is a little patch to allow the usage of reduced commands for example: twitter p "hello world" to post a twit Here is the patch : http://groups.google.com/group/ruby-twitter-gem/web/flexi_commands.patch diff --git a/lib/twitter/command.rb b/lib/twitter/command.rb index ea956f4..f0b6999 100644 --- a/lib/twitter/command.rb +++ b/lib/twitter/command.rb @@ -3,7 +3,8 @@ module Twitter class Command @@commands = [:post, :timeline, :friends, :friend, :followers, :follower, :featured, :important, :follow, :leave, :d] - + @@possible_commands = [] + @@template = < [options]\n\nAvailable Commands:" + Twitter::Command.commands.each do |c| + puts " - #{c}" + end + else + send(@@possible_commands.first) + end + + else puts "\nUsage: twitter [options]\n\nAvailable Commands:" Twitter::Command.commands.each do |c| puts " - #{c}" @@ -246,4 +257,4 @@ EOF end end end -end \ No newline at end of file +end diff --git a/lib/twitter/version.rb b/lib/twitter/version.rb index 1b43e70..96049f7 100644 --- a/lib/twitter/version.rb +++ b/lib/twitter/version.rb @@ -1,3 +1,26 @@ +class Array + + def include_part_of?(entry) + + possible_commands = [] + self.each do |c| + r = c.to_s.match(/#{entry}.*/) + if !c.to_s.match(/^#{entry}.*/).nil? + possible_commands << c + end + end + + if possible_commands.empty? + return false + else + return possible_commands + end + + end + +end + + module Twitter #:nodoc: module VERSION #:nodoc: MAJOR = 0