File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
# encoding: utf-8
2
+ require 'time'
2
3
3
4
QUERY = ARGV [ 0 ] . to_s . strip
4
5
5
6
require_relative "../lib/qiita"
6
7
7
8
data = Qiita ::API . search ( QUERY )
9
+ data . sort! { |a , b | b [ 'stock_count' ] <=> a [ 'stock_count' ] }
8
10
9
11
results = [ ]
10
12
data . each do |q |
11
13
arg = q [ 'url' ]
12
- subtitle = "Stocks: " + q [ 'stock_count' ] . to_s + " LGTM: " + q [ 'lgtm_count ' ] . to_s + " Comments: " + q [ 'comment_count' ] . to_s + " Create At:" + q [ 'created_at' ]
14
+ subtitle = q [ 'stock_count' ] . to_s + " Stocks, " + q [ 'comment_count ' ] . to_s + " Comments, " + Time . parse ( q [ 'created_at' ] ) . strftime ( "%Y/%m/%d %H:%M:%S" ) + " Created"
13
15
14
16
item = {
15
- :uid => q [ 'id' ] ,
17
+ :uid => nil ,
16
18
:arg => arg ,
17
19
:title => q [ 'title' ] ,
18
20
:subtitle => subtitle ,
Original file line number Diff line number Diff line change 1
1
# encoding: utf-8
2
+ require 'time'
2
3
3
4
QUERY = ARGV [ 0 ] . to_s . strip
4
5
16
17
end
17
18
18
19
data = Qiita ::API . search ( QUERY , :token => config . token , :stocked => 1 )
20
+ data . sort! { |a , b | b [ 'stock_count' ] <=> a [ 'stock_count' ] }
19
21
20
22
results = [ ]
21
23
data . each do |q |
22
- subtitle = "Stocks: " + q [ 'stock_count' ] . to_s + " LGTM: " + q [ 'lgtm_count ' ] . to_s + " Comments: " + q [ 'comment_count' ] . to_s + " Create At:" + q [ 'created_at' ]
24
+ subtitle = q [ 'stock_count' ] . to_s + " Stocks, " + q [ 'comment_count ' ] . to_s + " Comments, " + Time . parse ( q [ 'created_at' ] ) . strftime ( "%Y/%m/%d %H:%M:%S" ) + " Created"
23
25
24
26
item = {
25
- :uid => q [ 'id' ] ,
27
+ :uid => nil ,
26
28
:arg => q [ 'url' ] ,
27
29
:title => q [ 'title' ] ,
28
30
:subtitle => subtitle ,
You can’t perform that action at this time.
0 commit comments