jugyo-termtter 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -7,5 +7,6 @@ bin/termtter
7
7
  lib/termtter.rb
8
8
  lib/termtter/stdout.rb
9
9
  lib/termtter/notify-send.rb
10
+ lib/termtter/standard_commands.rb
10
11
  test/test_termtter.rb
11
12
 
data/lib/termtter.rb CHANGED
@@ -10,7 +10,7 @@ $:.unshift(File.dirname(__FILE__)) unless
10
10
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
11
11
 
12
12
  module Termtter
13
- VERSION = '0.3.1'
13
+ VERSION = '0.3.2'
14
14
 
15
15
  class CommandNotFound < StandardError; end
16
16
 
@@ -0,0 +1,65 @@
1
+ class Termtter::Client
2
+
3
+ add_command /^(update|u)\s+(.*)/ do |t, m|
4
+ text = m[2]
5
+ next if text.empty?
6
+ t.update_status(text)
7
+ puts "=> #{text}"
8
+ end
9
+
10
+ add_command /^(list|l)\s*$/ do |t, m|
11
+ t.list_friends_timeline()
12
+ end
13
+
14
+ add_command /^(list|l)\s+([^\s]+)/ do |t, m|
15
+ t.get_user_timeline(m[2])
16
+ end
17
+
18
+ add_command /^(search|s)\s+(.*)/ do |t, m|
19
+ query = m[2]
20
+ unless query.empty?
21
+ t.search(query)
22
+ end
23
+ end
24
+
25
+ add_command /^(replies|r)\s*$/ do |t, m|
26
+ t.replies()
27
+ end
28
+
29
+ add_command /^show\s+([^\s]+)/ do |t, m|
30
+ t.show($1)
31
+ end
32
+
33
+ add_command /^pause\s*$/ do |t, m|
34
+ t.pause
35
+ end
36
+
37
+ add_command /^resume\s*$/ do |t, m|
38
+ t.resume
39
+ end
40
+
41
+ add_command /^exit\s*$/ do |t, m|
42
+ t.exit
43
+ end
44
+
45
+ add_command /^help\s*$/ do |t, m|
46
+ puts <<-EOS
47
+ exit Exit
48
+ help Print this help message
49
+ list,l List the posts in your friends timeline
50
+ list USERNAME List the posts in the the given user's timeline
51
+ pause Pause updating
52
+ update,u TEXT Post a new message
53
+ resume Resume updating
54
+ replies,r List the most recent @replies for the authenticating user
55
+ search,s TEXT Search for Twitter
56
+ show ID Show a single status
57
+ EOS
58
+ end
59
+
60
+ add_command /^eval\s+(.*)$/ do |t, m|
61
+ result = t.instance_eval m[1] unless m[1].empty?
62
+ puts "=> #{result.inspect}"
63
+ end
64
+
65
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jugyo-termtter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo
@@ -61,6 +61,7 @@ files:
61
61
  - lib/termtter.rb
62
62
  - lib/termtter/stdout.rb
63
63
  - lib/termtter/notify-send.rb
64
+ - lib/termtter/standard_commands.rb
64
65
  - test/test_termtter.rb
65
66
  has_rdoc: true
66
67
  homepage: http://github.com/jugyo/termtter