ayadn 1.8.2 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/CHANGELOG.md +73 -52
  4. data/README.md +17 -3
  5. data/ayadn.gemspec +3 -4
  6. data/doc/01-index.md +6 -5
  7. data/doc/02-install.md +23 -1
  8. data/doc/03-first-steps.md +22 -28
  9. data/doc/04-options.md +1 -1
  10. data/doc/05-streams.md +29 -9
  11. data/doc/06-post.md +13 -5
  12. data/doc/07-actions.md +63 -1
  13. data/doc/08-listings.md +112 -4
  14. data/doc/09-accounts.md +17 -3
  15. data/doc/10-nicerank.md +5 -5
  16. data/doc/11-blacklist.md +8 -14
  17. data/doc/12-alias.md +1 -13
  18. data/doc/14-set.md +8 -110
  19. data/doc/15-nowplaying.md +16 -4
  20. data/doc/18-contact.md +14 -13
  21. data/doc/19-examples.md +2 -0
  22. data/lib/ayadn/action.rb +322 -183
  23. data/lib/ayadn/alias.rb +17 -45
  24. data/lib/ayadn/annotations.rb +1 -1
  25. data/lib/ayadn/api.rb +7 -8
  26. data/lib/ayadn/app.rb +99 -12
  27. data/lib/ayadn/authorize.rb +92 -57
  28. data/lib/ayadn/blacklist.rb +52 -62
  29. data/lib/ayadn/check.rb +81 -74
  30. data/lib/ayadn/cnx.rb +77 -26
  31. data/lib/ayadn/databases.rb +890 -105
  32. data/lib/ayadn/debug.rb +30 -89
  33. data/lib/ayadn/descriptions.rb +876 -329
  34. data/lib/ayadn/endpoints.rb +2 -2
  35. data/lib/ayadn/errors.rb +9 -9
  36. data/lib/ayadn/extend.rb +8 -1
  37. data/lib/ayadn/fileops.rb +10 -8
  38. data/lib/ayadn/mark.rb +79 -56
  39. data/lib/ayadn/migration.rb +427 -0
  40. data/lib/ayadn/nicerank.rb +74 -72
  41. data/lib/ayadn/nowplaying.rb +123 -60
  42. data/lib/ayadn/nowwatching.rb +26 -10
  43. data/lib/ayadn/pinboard.rb +12 -7
  44. data/lib/ayadn/post.rb +40 -37
  45. data/lib/ayadn/profile.rb +5 -2
  46. data/lib/ayadn/scroll.rb +20 -5
  47. data/lib/ayadn/search.rb +30 -22
  48. data/lib/ayadn/set.rb +146 -50
  49. data/lib/ayadn/settings.rb +66 -67
  50. data/lib/ayadn/status.rb +459 -234
  51. data/lib/ayadn/stream.rb +80 -46
  52. data/lib/ayadn/switch.rb +51 -47
  53. data/lib/ayadn/tvshow.rb +47 -15
  54. data/lib/ayadn/version.rb +1 -1
  55. data/lib/ayadn/view.rb +119 -60
  56. data/lib/ayadn/workers.rb +144 -92
  57. data/lib/ayadn.rb +7 -8
  58. data/spec/mock/ayadn/accounts.sqlite +0 -0
  59. data/spec/mock/ayadn.sqlite +0 -0
  60. data/spec/unit/annotations_spec.rb +12 -13
  61. data/spec/unit/api_spec.rb +3 -4
  62. data/spec/unit/blacklistworkers_spec.rb +18 -23
  63. data/spec/unit/databases_spec.rb +51 -36
  64. data/spec/unit/endpoints_spec.rb +5 -2
  65. data/spec/unit/extend_spec.rb +24 -0
  66. data/spec/unit/nicerank_spec.rb +13 -13
  67. data/spec/unit/post_spec.rb +47 -36
  68. data/spec/unit/set_spec.rb +67 -96
  69. data/spec/unit/view_spec.rb +12 -6
  70. data/spec/unit/workers_spec.rb +38 -12
  71. data/tags +1285 -0
  72. metadata +29 -39
  73. data/spec/mock/aliases.db +0 -0
  74. data/spec/mock/blacklist.db +0 -0
  75. data/spec/mock/bookmarks.db +0 -0
  76. data/spec/mock/channels.db +0 -0
  77. data/spec/mock/index.db +0 -0
  78. data/spec/mock/nicerank.db +0 -0
  79. data/spec/mock/pagination.db +0 -0
  80. data/spec/mock/users.db +0 -0
  81. data/spec/unit/status_spec.rb +0 -9
data/lib/ayadn/alias.rb CHANGED
@@ -8,22 +8,22 @@ module Ayadn
8
8
  def create(*args)
9
9
  begin
10
10
  init
11
+ status = Status.new
11
12
  unless args.empty?
12
13
  channel, channel_alias = args[0], args[1]
13
14
  else
14
- abort(Status.wrong_arguments)
15
+ status.wrong_arguments
16
+ exit
15
17
  end
16
18
  if channel.is_integer?
17
19
  Databases.create_alias(channel, channel_alias)
18
20
  Logs.rec.info "Added alias '#{channel_alias}' for channel #{channel}."
19
- puts Status.done
21
+ status.done
20
22
  else
21
- puts Status.error_missing_channel_id
23
+ status.error_missing_channel_id
22
24
  end
23
25
  rescue => e
24
26
  Errors.global_error({error: e, caller: caller, data: [args]})
25
- ensure
26
- Databases.close_all
27
27
  end
28
28
  end
29
29
 
@@ -36,63 +36,36 @@ module Ayadn
36
36
  unless args.empty?
37
37
  Databases.delete_alias(args[0])
38
38
  Logs.rec.info "Deleted alias '#{args[0]}'."
39
- puts Status.done
39
+ Status.new.done
40
40
  else
41
- abort(Status.wrong_arguments)
41
+ Status.new.wrong_arguments
42
+ exit
42
43
  end
43
44
  rescue => e
44
45
  Errors.global_error({error: e, caller: caller, data: [args]})
45
- ensure
46
- Databases.close_all
47
- end
48
- end
49
-
50
- desc "import DATABASE", "Imports an aliases database from a backed up Ayadn account"
51
- long_desc Descriptions.alias_import
52
- def import(database)
53
- begin
54
- init
55
- unless database.nil?
56
- new_db = File.realpath(database)
57
- else
58
- abort(Status.wrong_arguments)
59
- end
60
- if File.exist?(new_db)
61
- Databases.import_aliases(new_db)
62
- Logs.rec.info "Imported '#{new_db}' values in aliases database."
63
- puts Status.done
64
- else
65
- puts "\nFile '#{new_db}' doesn't exist.".color(:red)
66
- end
67
- rescue => e
68
- Errors.global_error({error: e, caller: caller, data: [database]})
69
- ensure
70
- Databases.close_all
71
46
  end
72
47
  end
73
48
 
74
49
  desc "list", "List previously created aliases"
75
50
  long_desc Descriptions.alias_list
76
51
  option :raw, aliases: "-x", type: :boolean, desc: "Outputs the raw list in JSON"
52
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
77
53
  def list
78
54
  begin
79
55
  init
80
- list = Databases.aliases
56
+ Settings.options[:timeline][:compact] = true if options[:compact] == true
57
+ list = Databases.all_aliases
81
58
  unless list.empty? || list.nil?
82
59
  if options[:raw]
83
- h = {}
84
- list.each {|k,v| h[k] = v}
85
- puts h.to_json
60
+ puts list.to_json
86
61
  else
87
62
  View.new.page Workers.new.build_aliases_list(list)
88
63
  end
89
64
  else
90
- puts Status.empty_list
65
+ Status.new.empty_list
91
66
  end
92
67
  rescue => e
93
68
  Errors.global_error({error: e, caller: caller, data: [options]})
94
- ensure
95
- Databases.close_all
96
69
  end
97
70
  end
98
71
 
@@ -100,19 +73,18 @@ module Ayadn
100
73
  def clear
101
74
  begin
102
75
  init
103
- puts "\n\nAre you sure you want to erase all the content of your aliases database?\n\n[y/N]\n".color(:red)
76
+ status = Status.new
77
+ status.ask_clear_databases
104
78
  input = STDIN.getch
105
79
  if input == 'y' || input == 'Y'
106
80
  Databases.clear_aliases
107
81
  Logs.rec.info "Cleared the aliases database."
108
- puts Status.done
82
+ status.done
109
83
  else
110
- abort Status.canceled
84
+ status.canceled
111
85
  end
112
86
  rescue => e
113
87
  Errors.global_error({error: e, caller: caller, data: []})
114
- ensure
115
- Databases.close_all
116
88
  end
117
89
  end
118
90
 
@@ -161,7 +161,7 @@ module Ayadn
161
161
  end
162
162
 
163
163
  def nowplaying(dic)
164
- return nowplaying_silent(dic) if dic[:options][:no_url]
164
+ return nowplaying_silent(dic) if dic[:options][:no_url] == true || dic[:visible] == false
165
165
  [{
166
166
  "type" => "com.ayadn.nowplaying",
167
167
  "value" => {
data/lib/ayadn/api.rb CHANGED
@@ -4,6 +4,7 @@ module Ayadn
4
4
 
5
5
  def initialize
6
6
  @workers = Workers.new
7
+ @status = Status.new
7
8
  end
8
9
 
9
10
  def get_unified(options)
@@ -268,12 +269,7 @@ module Ayadn
268
269
  else
269
270
  directed = 0
270
271
  end
271
- html = arg[:html] || Settings.options[:timeline][:html]
272
- if html == true || html == 1
273
- html = 1
274
- else
275
- html = 0
276
- end
272
+ html = 0
277
273
  if arg[:since_id]
278
274
  "&count=#{count}&include_html=#{html}&include_directed_posts=#{directed}&include_deleted=0&include_annotations=1&since_id=#{arg[:since_id]}"
279
275
  elsif arg[:recent_message]
@@ -287,7 +283,7 @@ module Ayadn
287
283
 
288
284
  def paginate options, target
289
285
  if options[:new] || options[:scroll]
290
- return {since_id: Databases.pagination[target]}
286
+ return {since_id: Databases.find_last_id_from(target)}
291
287
  end
292
288
  return options
293
289
  end
@@ -309,7 +305,10 @@ module Ayadn
309
305
  big_hash = {}
310
306
  loop do
311
307
  resp = get_parsed_response(get_list_url(username, target, options))
312
- abort(Status.user_404(username)) if resp['meta']['code'] == 404
308
+ if resp['meta']['code'] == 404
309
+ @status.user_404(username)
310
+ exit
311
+ end
313
312
  users = @workers.extract_users(resp)
314
313
  big_hash.merge!(users)
315
314
  break if resp['meta']['min_id'] == nil
data/lib/ayadn/app.rb CHANGED
@@ -3,7 +3,7 @@ module Ayadn
3
3
  class App < Thor
4
4
  package_name "Ayadn"
5
5
 
6
- %w{action stream api search descriptions endpoints cnx view workers settings post status extend databases fileops logs pinboard set alias errors blacklist scroll authorize switch mark nicerank debug check nowplaying nowwatching tvshow annotations profile}.each { |r| require_relative "#{r}" }
6
+ %w{action stream api search descriptions endpoints cnx view workers settings post status extend databases fileops logs pinboard set alias errors blacklist scroll authorize switch mark nicerank debug check nowplaying nowwatching tvshow annotations profile migration}.each { |r| require_relative "#{r}" }
7
7
 
8
8
  ##
9
9
  # These methods are intended to be called from the CLI.
@@ -18,6 +18,7 @@ module Ayadn
18
18
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
19
19
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
20
20
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
21
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
21
22
  def timeline
22
23
  Action.new.unified(options)
23
24
  end
@@ -31,6 +32,7 @@ module Ayadn
31
32
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
32
33
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
33
34
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
35
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
34
36
  def checkins
35
37
  Action.new.checkins(options)
36
38
  end
@@ -44,6 +46,7 @@ module Ayadn
44
46
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
45
47
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
46
48
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
49
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
47
50
  def global
48
51
  Action.new.global(options)
49
52
  end
@@ -57,6 +60,7 @@ module Ayadn
57
60
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
58
61
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
59
62
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
63
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
60
64
  def trending
61
65
  Action.new.trending(options)
62
66
  end
@@ -70,6 +74,7 @@ module Ayadn
70
74
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
71
75
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
72
76
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
77
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
73
78
  def photos
74
79
  Action.new.photos(options)
75
80
  end
@@ -83,6 +88,7 @@ module Ayadn
83
88
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
84
89
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
85
90
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
91
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
86
92
  def conversations
87
93
  Action.new.conversations(options)
88
94
  end
@@ -95,6 +101,7 @@ module Ayadn
95
101
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
96
102
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
97
103
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
104
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
98
105
  def mentions(*username)
99
106
  Action.new.mentions(username, options)
100
107
  end
@@ -107,6 +114,7 @@ module Ayadn
107
114
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
108
115
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
109
116
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
117
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
110
118
  def userposts(*username)
111
119
  Action.new.posts(username, options)
112
120
  end
@@ -115,6 +123,7 @@ module Ayadn
115
123
  map "-int" => :interactions
116
124
  long_desc Descriptions.interactions
117
125
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
126
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
118
127
  def interactions
119
128
  Action.new.interactions(options)
120
129
  end
@@ -126,6 +135,7 @@ module Ayadn
126
135
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
127
136
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
128
137
  option :extract, aliases: "-e", type: :boolean, desc: Descriptions.options_extract
138
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
129
139
  def whatstarred(*username)
130
140
  Action.new.whatstarred(username, options)
131
141
  end
@@ -134,6 +144,8 @@ module Ayadn
134
144
  map "-wor" => :whoreposted
135
145
  long_desc Descriptions.whoreposted
136
146
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
147
+ option :force, aliases: "-f", type: :boolean, desc: "Force retrieve the actual post id (ignores index)"
148
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
137
149
  def whoreposted(post_id)
138
150
  Action.new.whoreposted(post_id, options)
139
151
  end
@@ -142,6 +154,8 @@ module Ayadn
142
154
  map "-wos" => :whostarred
143
155
  long_desc Descriptions.whostarred
144
156
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
157
+ option :force, aliases: "-f", type: :boolean, desc: "Force retrieve the actual post id (ignores index)"
158
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
145
159
  def whostarred(post_id)
146
160
  Action.new.whostarred(post_id, options)
147
161
  end
@@ -153,6 +167,7 @@ module Ayadn
153
167
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
154
168
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
155
169
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
170
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
156
171
  long_desc Descriptions.convo
157
172
  def convo(post_id)
158
173
  Action.new.convo(post_id, options)
@@ -162,6 +177,12 @@ module Ayadn
162
177
  map "-fwg" => :followings
163
178
  long_desc Descriptions.followings
164
179
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
180
+ option :reverse, aliases: "-r", type: :boolean, desc: "Reverses the list original order"
181
+ option :username, aliases: "-u", type: :boolean, desc: "Sort the list by: username"
182
+ option :name, aliases: "-n", type: :boolean, desc: "Sort the list by: name"
183
+ option :posts_day, aliases: "-d", type: :boolean, desc: "Sort the list by: posts/day"
184
+ option :posts, aliases: "-p", type: :boolean, desc: "Sort the list by: total posts"
185
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
165
186
  def followings(*username)
166
187
  Action.new.followings(username, options)
167
188
  end
@@ -170,6 +191,12 @@ module Ayadn
170
191
  map "-fwr" => :followers
171
192
  long_desc Descriptions.followers
172
193
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
194
+ option :reverse, aliases: "-r", type: :boolean, desc: "Reverses the list original order"
195
+ option :username, aliases: "-u", type: :boolean, desc: "Sort the list by: username"
196
+ option :name, aliases: "-n", type: :boolean, desc: "Sort the list by: name"
197
+ option :posts_day, aliases: "-d", type: :boolean, desc: "Sort the list by: posts/day"
198
+ option :posts, aliases: "-p", type: :boolean, desc: "Sort the list by: total posts"
199
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
173
200
  def followers(*username)
174
201
  Action.new.followers(username, options)
175
202
  end
@@ -178,6 +205,12 @@ module Ayadn
178
205
  map "-mtd" => :muted
179
206
  long_desc Descriptions.muted
180
207
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
208
+ option :reverse, aliases: "-r", type: :boolean, desc: "Reverses the list original order"
209
+ option :username, aliases: "-u", type: :boolean, desc: "Sort the list by: username"
210
+ option :name, aliases: "-n", type: :boolean, desc: "Sort the list by: name"
211
+ option :posts_day, aliases: "-d", type: :boolean, desc: "Sort the list by: posts/day"
212
+ option :posts, aliases: "-p", type: :boolean, desc: "Sort the list by: total posts"
213
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
181
214
  def muted
182
215
  Action.new.muted(options)
183
216
  end
@@ -186,6 +219,12 @@ module Ayadn
186
219
  map "-bkd" => :blocked
187
220
  long_desc Descriptions.blocked
188
221
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
222
+ option :reverse, aliases: "-r", type: :boolean, desc: "Reverses the list original order"
223
+ option :username, aliases: "-u", type: :boolean, desc: "Sort the list by: username"
224
+ option :name, aliases: "-n", type: :boolean, desc: "Sort the list by: name"
225
+ option :posts_day, aliases: "-d", type: :boolean, desc: "Sort the list by: posts/day"
226
+ option :posts, aliases: "-p", type: :boolean, desc: "Sort the list by: total posts"
227
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
189
228
  def blocked
190
229
  Action.new.blocked(options)
191
230
  end
@@ -196,6 +235,7 @@ module Ayadn
196
235
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
197
236
  option :extract, aliases: "-e", type: :boolean, desc: Descriptions.options_extract
198
237
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
238
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
199
239
  def hashtag(hashtag)
200
240
  Action.new.hashtag(hashtag, options)
201
241
  end
@@ -206,6 +246,7 @@ module Ayadn
206
246
  option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count
207
247
  option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index
208
248
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
249
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
209
250
  option :extract, aliases: "-e", type: :boolean, desc: Descriptions.options_extract
210
251
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
211
252
  option :messages, type: :boolean, desc: 'Search for WORD(S) in messages, including PMs.'
@@ -220,6 +261,7 @@ module Ayadn
220
261
  map "-sg" => :settings
221
262
  long_desc Descriptions.settings
222
263
  option :raw, aliases: "-x", type: :boolean, desc: "Outputs the raw list in JSON"
264
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
223
265
  def settings
224
266
  Action.new.view_settings(options)
225
267
  end
@@ -228,6 +270,7 @@ module Ayadn
228
270
  map "-ui" => :userinfo
229
271
  long_desc Descriptions.userinfo
230
272
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
273
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
231
274
  def userinfo(*username)
232
275
  Action.new.userinfo(username, options)
233
276
  end
@@ -252,6 +295,7 @@ module Ayadn
252
295
  long_desc Descriptions.postinfo
253
296
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
254
297
  option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
298
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
255
299
  def postinfo(post_id)
256
300
  Action.new.postinfo(post_id, options)
257
301
  end
@@ -269,8 +313,9 @@ module Ayadn
269
313
  desc "delete POST", "Delete a post (-D)"
270
314
  map "-D" => :delete
271
315
  long_desc Descriptions.delete
316
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
272
317
  def delete(*post_id)
273
- Action.new.delete(post_id)
318
+ Action.new.delete(post_id, options)
274
319
  end
275
320
 
276
321
  desc "delete_m CHANNEL MESSAGE", "Delete a message (-DM)"
@@ -304,29 +349,33 @@ module Ayadn
304
349
  desc "unrepost POST", "Unrepost a post (-UR)"
305
350
  map "-UR" => :unrepost
306
351
  long_desc Descriptions.unrepost
307
- def unrepost(post_id)
308
- Action.new.unrepost(post_id)
352
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
353
+ def unrepost(*post_id)
354
+ Action.new.unrepost(post_id, options)
309
355
  end
310
356
 
311
357
  desc "unstar POST", "Unstar a post (-US)"
312
358
  map "-US" => :unstar
313
359
  long_desc Descriptions.unstar
314
- def unstar(post_id)
315
- Action.new.unstar(post_id)
360
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
361
+ def unstar(*post_id)
362
+ Action.new.unstar(post_id, options)
316
363
  end
317
364
 
318
365
  desc "star POST", "Star a post (-ST)"
319
366
  map "-ST" => :star
320
367
  long_desc Descriptions.star
321
- def star(post_id)
322
- Action.new.star(post_id)
368
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
369
+ def star(*post_id)
370
+ Action.new.star(post_id, options)
323
371
  end
324
372
 
325
373
  desc "repost POST", "Repost a post (-O)"
326
374
  map "-O" => :repost
327
375
  long_desc Descriptions.repost
328
- def repost(post_id)
329
- Action.new.repost(post_id)
376
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
377
+ def repost(*post_id)
378
+ Action.new.repost(post_id, options)
330
379
  end
331
380
 
332
381
  desc "follow @USERNAME", "Follow @username (-FO)"
@@ -354,6 +403,10 @@ module Ayadn
354
403
  map "-ch" => :channels
355
404
  long_desc Descriptions.channels
356
405
  option :id, aliases: "-i", type: :array, desc: "Retrieve only the specified channel(s)"
406
+ option :broadcasts, aliases: "-b", type: :boolean, desc: "Only your broadcast channel(s)"
407
+ option :messages, aliases: "-m", type: :boolean, desc: "Only your private messaging channel(s)"
408
+ option :patter, aliases: "-p", type: :boolean, desc: "Only your patter room channel(s)"
409
+ option :other, aliases: "-o", type: :boolean, desc: "Only other than private messaging and broadcasts channel(s)"
357
410
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
358
411
  def channels
359
412
  Action.new.channels(options)
@@ -367,6 +420,7 @@ module Ayadn
367
420
  option :count, aliases: "-c", type: :numeric, desc: "Specify the number of messages to retrieve"
368
421
  option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw
369
422
  option :silent, aliases: "-z", type: :boolean, desc: "Do not mark the channel as read"
423
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
370
424
  def messages(channel_id)
371
425
  Action.new.messages(channel_id, options)
372
426
  end
@@ -374,6 +428,7 @@ module Ayadn
374
428
  desc "messages_unread", "Show your unread private messages (-pmu)"
375
429
  map "-pmu" => :messages_unread
376
430
  option :silent, aliases: "-z", type: :boolean, desc: "Do not mark the channels as read"
431
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
377
432
  long_desc Descriptions.messages_unread
378
433
  def messages_unread
379
434
  Action.new.messages_unread(options)
@@ -381,8 +436,9 @@ module Ayadn
381
436
 
382
437
  desc "pin POST TAG(S)", "Export a post's link and text with tags to Pinboard"
383
438
  long_desc Descriptions.pin
439
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
384
440
  def pin(post_id, *tags)
385
- Action.new.pin(post_id, tags)
441
+ Action.new.pin(post_id, tags, options)
386
442
  end
387
443
 
388
444
  desc "post Your text", "Simple post to App.net (-P)"
@@ -392,6 +448,7 @@ module Ayadn
392
448
  option :youtube, aliases: "-Y", type: :array, desc: "Embed a Youtube video in the new post"
393
449
  option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new post"
394
450
  option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new post"
451
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
395
452
  def post(*args)
396
453
  Action.new.post(args, options)
397
454
  end
@@ -404,6 +461,7 @@ module Ayadn
404
461
  option :youtube, aliases: "-Y", type: :array, desc: "Embed a Youtube video in the new post"
405
462
  option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new post"
406
463
  option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new post"
464
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
407
465
  def write
408
466
  Action.new.write(options)
409
467
  end
@@ -415,6 +473,7 @@ module Ayadn
415
473
  option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new message"
416
474
  option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new message"
417
475
  option :silent, aliases: "-z", type: :boolean, desc: "Do not mark the channel as read"
476
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
418
477
  def pm(*username)
419
478
  Action.new.pmess(username, options)
420
479
  end
@@ -427,6 +486,7 @@ module Ayadn
427
486
  option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new message"
428
487
  option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new message"
429
488
  option :silent, aliases: "-z", type: :boolean, desc: "Do not mark the channel as read"
489
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
430
490
  def send_to_channel(channel_id)
431
491
  Action.new.send_to_channel(channel_id, options)
432
492
  end
@@ -439,6 +499,8 @@ module Ayadn
439
499
  option :vimeo, aliases: "-V", type: :array, desc: "Embed a Vimeo video in the new post"
440
500
  option :poster, aliases: "-M", type: :array, desc: "Embed a movie poster, from title, in the new post"
441
501
  option :noredirect, aliases: "-n", type: :boolean, desc: "Do not respond to the original post but to the reposted one if possible"
502
+ option :force, aliases: "-f", type: :boolean, desc: Descriptions.options_force
503
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
442
504
  def reply(id)
443
505
  ayadn = Action.new
444
506
  ayadn.reply(id, options)
@@ -482,6 +544,9 @@ module Ayadn
482
544
  long_desc Descriptions.nowplaying
483
545
  option :no_url, aliases: "-n", type: :boolean, desc: "Don't append preview or album art at the end of the post"
484
546
  option :lastfm, aliases: "-l", type: :boolean, desc: "Get current track from Last.fm instead of iTunes"
547
+ option :hashtag, aliases: "-h", type: :array, desc: "Specify a custom hashtag"
548
+ option :text, aliases: "-t", type: :array, desc: "Add custom text"
549
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
485
550
  def nowplaying
486
551
  Action.new.nowplaying(options)
487
552
  end
@@ -492,6 +557,7 @@ module Ayadn
492
557
  map "-NW" => :movie
493
558
  long_desc Descriptions.nowwatching
494
559
  option :alt, aliases: "-a", type: :boolean, desc: "Select an alternative response if the first didn't match"
560
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
495
561
  def movie(*title)
496
562
  Action.new.nowwatching(title, options)
497
563
  end
@@ -501,6 +567,7 @@ module Ayadn
501
567
  long_desc Descriptions.tvshow
502
568
  option :alt, aliases: "-a", type: :boolean, desc: "Select an alternative response if the first didn't match"
503
569
  option :banner, aliases: "-b", type: :boolean, desc: "Inserts the show banner instead of the show poster"
570
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already (after posting)"
504
571
  def tvshow(*title)
505
572
  Action.new.tvshow(title, options)
506
573
  end
@@ -508,20 +575,32 @@ module Ayadn
508
575
  desc "random", "Show random posts from App.net (-rnd)"
509
576
  map "-rnd" => :random
510
577
  option :wait, aliases: "-w", type: :numeric, desc: "In seconds, time to wait before next page"
578
+ option :compact, aliases: "-k", type: :boolean, desc: "Force the view to be compact if not already"
511
579
  long_desc Descriptions.random_posts
512
580
  def random
513
581
  Action.new.random_posts(options)
514
582
  end
515
583
 
516
- desc "authorize", "Authorize Ayadn (-auth)"
584
+ desc "authorize", "Authorize Ayadn (-AU)"
517
585
  map "-auth" => :authorize
586
+ map "-AU" => :authorize
518
587
  long_desc Descriptions.authorize
519
588
  def authorize
520
589
  Authorize.new.authorize
521
590
  end
522
591
 
592
+ desc "unauthorize @USERNAME", "Unauthorize an Ayadn user account (-UA)"
593
+ map "-unauth" => :unauthorize
594
+ map "-UA" => :unauthorize
595
+ option :delete, aliases: "-D", type: :boolean, desc: "Deletes user folders (default: false)"
596
+ long_desc Descriptions.unauthorize
597
+ def unauthorize(*user)
598
+ Authorize.new.unauthorize(user, options)
599
+ end
600
+
523
601
  desc "switch @USERNAME", "Switch between authorized App.net accounts (-@)"
524
602
  map "-@" => :switch
603
+ map "login" => :switch
525
604
  option :list, aliases: "-l", type: :boolean, desc: "List authorized accounts"
526
605
  long_desc Descriptions.switch
527
606
  def switch(*username)
@@ -538,5 +617,13 @@ module Ayadn
538
617
  Action.new.version
539
618
  end
540
619
 
620
+ desc "migrate", "Migrate databases (upgrade accounts)", :hide => true
621
+ map "upgrade" => :migrate
622
+ long_desc Descriptions.migrate
623
+ def migrate
624
+ mig = Migration.new
625
+ mig.all
626
+ end
627
+
541
628
  end
542
629
  end