pocket-console 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/pocketConsole.rb +5 -0
- data/lib/tagStats.rb +75 -102
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77bb64cbb0e25495054b4a4c072784ac89751741
|
4
|
+
data.tar.gz: 6a743f070da60692ce6c50695f02928e5b4ff7d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e753dba239a54814afa4183b71767e46cf91be727779f6c50c54e1766ccc9334aa2ac862b5c870a7b37784a9d602a4b5802c3539dd23e9858b97654d4571b9
|
7
|
+
data.tar.gz: 7198c40430d9ce9050203853099cd5feb656055d4bba9c5d73d905b641fedcb38afffc135f8ae5e04a90f0aa9e16210f48d99cee125137d82d48e696d6abe8c0
|
data/CHANGELOG.md
CHANGED
data/lib/pocketConsole.rb
CHANGED
@@ -29,6 +29,11 @@ class PocketConsole
|
|
29
29
|
tagStats.print
|
30
30
|
end
|
31
31
|
|
32
|
+
def printSpecificTermsStats(terms)
|
33
|
+
tagStats = TagStats.new(@tagCollection)
|
34
|
+
tagStats.printSpecificTerms(terms)
|
35
|
+
end
|
36
|
+
|
32
37
|
def printItems
|
33
38
|
items = @taggedItems + @untaggedItems
|
34
39
|
itemsPrinter = ItemsPrinter.new(items)
|
data/lib/tagStats.rb
CHANGED
@@ -15,179 +15,152 @@ class TagStats
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def printMostUsed
|
18
|
-
@tags = @tags.sort_by{|_key, stats| stats['
|
19
|
-
|
20
|
-
puts ' Tag Stats - Most Used '
|
21
|
-
puts '---------------------------------'
|
18
|
+
@tags = @tags.sort_by{|_key, stats| stats['total']}.reverse!
|
19
|
+
printTitle(' Tag Stats - Most Used ')
|
22
20
|
printMostUsedUntilChange(10)
|
23
|
-
|
21
|
+
printSeparator
|
24
22
|
end
|
25
23
|
|
26
24
|
def printLessUsed
|
27
|
-
@tags = @tags.sort_by{|_key, stats| stats['
|
28
|
-
|
29
|
-
puts ' Tag Stats - Less Used '
|
30
|
-
puts '---------------------------------'
|
25
|
+
@tags = @tags.sort_by{|_key, stats| stats['total']}
|
26
|
+
printTitle(' Tag Stats - Less Used ')
|
31
27
|
printLessUsedUntilChange(3)
|
32
|
-
|
28
|
+
printSeparator
|
33
29
|
end
|
34
30
|
|
35
31
|
def printMostUnread
|
36
32
|
@tags = @tags.sort_by{|_key, stats| stats['unread']}.reverse!
|
37
|
-
|
38
|
-
puts ' Tag Stats - Most Unread '
|
39
|
-
puts '---------------------------------'
|
33
|
+
printTitle(' Tag Stats - Most Unread ')
|
40
34
|
printMostUnreadUntilChange(10)
|
41
|
-
|
35
|
+
printSeparator
|
42
36
|
end
|
43
37
|
|
44
38
|
def printLessUnread
|
45
39
|
@tags = @tags.sort_by{|_key, stats| stats['unread']}
|
46
|
-
|
47
|
-
puts ' Tag Stats - Less Unread '
|
48
|
-
puts '---------------------------------'
|
40
|
+
printTitle(' Tag Stats - Less Unread ')
|
49
41
|
printLessUnreadUntilChange(3)
|
50
|
-
|
42
|
+
printSeparator
|
51
43
|
end
|
52
44
|
|
53
45
|
|
54
|
-
def
|
46
|
+
def printSpecificTerms(terms)
|
47
|
+
|
48
|
+
specificTags = Hash.new
|
49
|
+
terms.each do |term|
|
50
|
+
if (@tags.has_key?(term))
|
51
|
+
specificTags[term] = @tags[term]
|
52
|
+
end
|
53
|
+
end
|
55
54
|
|
56
|
-
|
57
|
-
|
55
|
+
if (!specificTags.empty?)
|
56
|
+
aux = @tags
|
57
|
+
@tags = specificTags
|
58
|
+
printMostUnread
|
59
|
+
puts ''
|
60
|
+
@tags = aux
|
61
|
+
end
|
58
62
|
|
59
|
-
|
60
|
-
firstLoop = true
|
61
|
-
prevCount = 0
|
63
|
+
end
|
62
64
|
|
63
|
-
@tags.each do |tag, stats|
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
def printMostUsedUntilChange(changes)
|
67
|
+
printTableHeaderTotalUnread
|
68
|
+
printMostTableBody('total', 'unread',changes)
|
69
|
+
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
break
|
75
|
-
end
|
76
|
-
end
|
77
|
-
prevCount = stats['count']
|
71
|
+
def printLessUsedUntilChange(changes)
|
72
|
+
printTableHeaderTotalUnread
|
73
|
+
printLessTableBody('total', 'unread', changes)
|
74
|
+
end
|
78
75
|
|
79
|
-
|
80
|
-
|
76
|
+
def printMostUnreadUntilChange(changes)
|
77
|
+
printTableHeaderUnreadTotal
|
78
|
+
printMostTableBody('unread', 'total', changes)
|
79
|
+
end
|
81
80
|
|
82
|
-
|
81
|
+
def printLessUnreadUntilChange(changes)
|
82
|
+
printTableHeaderUnreadTotal
|
83
|
+
printLessTableBody('unread', 'total', changes)
|
84
|
+
end
|
83
85
|
|
86
|
+
def printTableHeaderTotalUnread
|
87
|
+
printTableHeader('total', 'unread')
|
84
88
|
end
|
85
89
|
|
90
|
+
def printTableHeaderUnreadTotal
|
91
|
+
printTableHeader('unread', 'total')
|
92
|
+
end
|
86
93
|
|
87
|
-
def printLessUsedUntilChange(changes)
|
88
94
|
|
89
|
-
|
95
|
+
def printTableHeader(firstColumn, secondColumn)
|
96
|
+
puts sprintf "%-13s | %6s | %7s", 'tag', firstColumn, secondColumn
|
90
97
|
puts '---------------------------------'
|
98
|
+
end
|
91
99
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
count = stats['count']
|
98
|
-
if (count > prevCount)
|
99
|
-
changeCount += 1
|
100
|
-
if (changeCount == changes)
|
101
|
-
break
|
102
|
-
end
|
103
|
-
end
|
104
|
-
prevCount = stats['count']
|
100
|
+
def printTitle(title)
|
101
|
+
puts '================================='
|
102
|
+
puts title
|
103
|
+
puts '---------------------------------'
|
104
|
+
end
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
def printSeparator
|
107
|
+
puts '================================='
|
108
|
+
end
|
108
109
|
|
109
|
-
end
|
110
110
|
|
111
|
+
def printRow(tag, firstColumnValue, secondColumnValue)
|
112
|
+
puts sprintf "%-13s | %6d | %7d", tag, firstColumnValue, secondColumnValue
|
111
113
|
end
|
112
114
|
|
113
115
|
|
114
|
-
def
|
115
|
-
|
116
|
-
puts sprintf "%-13s | %6s | %7s", 'tag', 'unread', 'total'
|
117
|
-
puts '---------------------------------'
|
116
|
+
def printMostTableBody(firstColumn, secondColumn, changes)
|
118
117
|
|
119
118
|
changeCount = 0
|
120
119
|
firstLoop = true
|
121
|
-
|
120
|
+
prevValue = 0
|
122
121
|
|
123
122
|
@tags.each do |tag, stats|
|
124
123
|
|
125
124
|
if (firstLoop)
|
126
|
-
prevCount = stats[
|
125
|
+
prevCount = stats[firstColumn]
|
127
126
|
firstLoop = false
|
128
127
|
end
|
129
128
|
|
130
|
-
|
131
|
-
if (
|
129
|
+
firstColumnValue = stats[firstColumn]
|
130
|
+
if (firstColumnValue < prevValue)
|
132
131
|
changeCount += 1
|
133
132
|
if (changeCount == changes)
|
134
133
|
break
|
135
134
|
end
|
136
135
|
end
|
137
|
-
|
136
|
+
prevValue = firstColumnValue
|
138
137
|
|
139
|
-
|
140
|
-
|
138
|
+
secondColumnValue = stats[secondColumn]
|
139
|
+
printRow(tag, firstColumnValue, secondColumnValue)
|
141
140
|
|
142
141
|
end
|
143
142
|
|
144
143
|
end
|
145
144
|
|
146
145
|
|
147
|
-
def
|
148
|
-
|
149
|
-
puts sprintf "%-13s | %6s | %7s", 'tag', 'unread', 'total'
|
150
|
-
puts '---------------------------------'
|
146
|
+
def printLessTableBody(firstColumn, secondColumn, changes)
|
151
147
|
|
152
148
|
changeCount = 0
|
153
149
|
prevCount = 0
|
154
150
|
|
155
151
|
@tags.each do |tag, stats|
|
156
|
-
|
157
|
-
|
158
|
-
if (
|
152
|
+
|
153
|
+
firstColumnValue = stats[firstColumn]
|
154
|
+
if (firstColumnValue > prevCount)
|
159
155
|
changeCount += 1
|
160
156
|
if (changeCount == changes)
|
161
157
|
break
|
162
158
|
end
|
163
159
|
end
|
164
|
-
prevCount = stats[
|
165
|
-
|
166
|
-
count = stats['count']
|
167
|
-
puts sprintf "%-13s | %6d | %7d", tag, unread, count
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
172
|
-
|
173
|
-
|
174
|
-
def printTopTable
|
175
|
-
|
176
|
-
puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
|
177
|
-
puts '---------------------------------'
|
178
|
-
top_count = 0
|
160
|
+
prevCount = stats[firstColumn]
|
179
161
|
|
180
|
-
|
181
|
-
|
182
|
-
count = stats['count']
|
183
|
-
unread = stats['unread']
|
184
|
-
puts sprintf "%-13s | %6d | %7d", tag, count, unread
|
185
|
-
|
186
|
-
top_count += 1
|
187
|
-
|
188
|
-
if (top_count == 10)
|
189
|
-
break
|
190
|
-
end
|
162
|
+
secondColumnValue = stats[secondColumn]
|
163
|
+
printRow(tag, firstColumnValue, secondColumnValue)
|
191
164
|
|
192
165
|
end
|
193
166
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pocket-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Cedillo
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.3
|
27
27
|
description: Stats about Pocket tags, on your console.
|
28
28
|
email: franco.cedillo@gmail.com
|
29
29
|
executables: []
|