imapcli 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +6 -6
- data/README.md +12 -1
- data/lib/imapcli/cli.rb +4 -0
- data/lib/imapcli/command.rb +6 -1
- data/lib/imapcli/version.rb +1 -1
- data/spec/lib/imapcli/command_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0736f0dbe2cb473770fb5f92f0f37546b9f26a6e892bbca3c69b072c1f06db9f
|
4
|
+
data.tar.gz: '0609a383ac74799eb2aade3d52fa0c5c811fc5cb4b253f1607e0b6f2dbe7cf01'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d818a1780fda1549bbd83581c2d0abbc4ecda7274cb411bedd450a8365e322153263c1f5b490b03a183e7c8cb02e5d382c82c8628ee43e1c1c1294f6e76afa
|
7
|
+
data.tar.gz: e664577a0949609bebd90a7bc08b94e4559001fcb7b26429958fe38801acd835089b030cad3d3b1fa09a95ccc51b400f6cb8f66befc4903ebe1cb9b4bb56746d
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [Version 2.1.0 (2025-03-16)][v2.1.0]
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- New command-line flag `-l`/`--limit` to limit the statistics output to
|
13
|
+
a given number of mailboxes (folders).
|
14
|
+
|
8
15
|
## [Version 2.0.1 (2025-03-11)][v2.0.1]
|
9
16
|
|
10
17
|
### Fixed
|
@@ -72,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
72
79
|
- Fix: Docker image.
|
73
80
|
- Fix: Options error message.
|
74
81
|
|
82
|
+
[v2.1.0]: https://github.com/bovender/imapcli/releases/tag/v2.1.0
|
75
83
|
[v2.0.1]: https://github.com/bovender/imapcli/releases/tag/v2.0.1
|
76
84
|
[v2.0.0]: https://github.com/bovender/imapcli/releases/tag/v2.0.0
|
77
85
|
[v1.0.7]: https://github.com/bovender/imapcli/releases/tag/v1.0.7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
imapcli (2.0.
|
4
|
+
imapcli (2.0.1)
|
5
5
|
activesupport (~> 8.0)
|
6
6
|
csv
|
7
7
|
descriptive_statistics (~> 2.5)
|
@@ -16,7 +16,7 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
activesupport (8.0.
|
19
|
+
activesupport (8.0.2)
|
20
20
|
base64
|
21
21
|
benchmark (>= 0.3)
|
22
22
|
bigdecimal
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
pp (>= 0.6.0)
|
84
84
|
rdoc (>= 4.0.0)
|
85
85
|
reline (>= 0.4.2)
|
86
|
-
json (2.10.
|
86
|
+
json (2.10.2)
|
87
87
|
language_server-protocol (3.17.0.4)
|
88
88
|
lint_roller (1.1.0)
|
89
89
|
listen (3.9.0)
|
@@ -92,7 +92,7 @@ GEM
|
|
92
92
|
logger (1.6.6)
|
93
93
|
lumberjack (1.2.10)
|
94
94
|
method_source (1.1.0)
|
95
|
-
minitest (5.25.
|
95
|
+
minitest (5.25.5)
|
96
96
|
nenv (0.3.0)
|
97
97
|
net-imap (0.5.6)
|
98
98
|
date
|
@@ -142,7 +142,7 @@ GEM
|
|
142
142
|
diff-lcs (>= 1.2.0, < 2.0)
|
143
143
|
rspec-support (~> 3.13.0)
|
144
144
|
rspec-support (3.13.2)
|
145
|
-
rubocop (1.
|
145
|
+
rubocop (1.74.0)
|
146
146
|
json (~> 2.3)
|
147
147
|
language_server-protocol (~> 3.17.0.2)
|
148
148
|
lint_roller (~> 1.1.0)
|
@@ -153,7 +153,7 @@ GEM
|
|
153
153
|
rubocop-ast (>= 1.38.0, < 2.0)
|
154
154
|
ruby-progressbar (~> 1.7)
|
155
155
|
unicode-display_width (>= 2.4.0, < 4.0)
|
156
|
-
rubocop-ast (1.
|
156
|
+
rubocop-ast (1.39.0)
|
157
157
|
parser (>= 3.3.1.0)
|
158
158
|
rubocop-performance (1.24.0)
|
159
159
|
lint_roller (~> 1.1)
|
data/README.md
CHANGED
@@ -263,7 +263,18 @@ keyword, as shown below.
|
|
263
263
|
|
264
264
|
Example:
|
265
265
|
|
266
|
-
|
266
|
+
docker run -it bin/imapcli -s yourserver.example.com -u myusername -P stats -r -o max_size Archive
|
267
|
+
|
268
|
+
#### Limiting the number of mailboxes
|
269
|
+
|
270
|
+
You can limit the number of mailboxes (folders) in the output table with the
|
271
|
+
`-l`/`--limit` flag. This flag takes an argument that indicates the maximum
|
272
|
+
number of mailboxes. THe default value for this argument is 10.
|
273
|
+
|
274
|
+
Use case: Say you have a very large IMAP account, and you would like to know the
|
275
|
+
5 folders that contain the largest messages. The command should be:
|
276
|
+
|
277
|
+
imapcli -s yourserver.example.com -u myusername -P stats -o max_size --limit 5
|
267
278
|
|
268
279
|
#### Obtaining comma-separated values (CSV)
|
269
280
|
|
data/lib/imapcli/cli.rb
CHANGED
@@ -74,6 +74,10 @@ module Imapcli
|
|
74
74
|
default: 'total_size'
|
75
75
|
c.switch %i[reverse], desc: 'Reverse sort order (largest first)', negatable: false
|
76
76
|
c.switch [:csv], desc: 'Output comma-separated values (CSV)'
|
77
|
+
c.flag %i[l limit],
|
78
|
+
desc: 'Limit the results to n folders (IMAP mailboxes)',
|
79
|
+
arg_name: 'max_lines',
|
80
|
+
default: 10
|
77
81
|
|
78
82
|
c.action do |_global_options, options, args| # rubocop:disable Metrics/BlockLength
|
79
83
|
raise unless @validator.stats_options_valid?(options, args)
|
data/lib/imapcli/command.rb
CHANGED
@@ -68,7 +68,12 @@ module Imapcli
|
|
68
68
|
yield current_count if block_given?
|
69
69
|
end
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
|
+
output = if options[:limit]
|
73
|
+
sorted_list(list, options).last(options[:limit].to_i)
|
74
|
+
else
|
75
|
+
sorted_list(list, options)
|
76
|
+
end.map do |mailbox|
|
72
77
|
stats_to_table(mailbox.full_name, mailbox.stats)
|
73
78
|
end
|
74
79
|
output << stats_to_table('Total', total_stats) if list.length > 1
|
data/lib/imapcli/version.rb
CHANGED
@@ -133,6 +133,11 @@ RSpec.describe Imapcli::Command do
|
|
133
133
|
expect(output).to be_a Array
|
134
134
|
expect(output[0][0]).to eq 'Inbox/Smallest/Messages'
|
135
135
|
end
|
136
|
+
|
137
|
+
it 'returns only the first n mailboxes' do
|
138
|
+
output = command.stats('Inbox', depth: -1, limit: 2)
|
139
|
+
expect(output.length).to eq 3 # including summary line
|
140
|
+
end
|
136
141
|
end
|
137
142
|
|
138
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imapcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kraus (bovender)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|