du_pretty 1.0.0 → 1.0.1
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/Gemfile.lock +1 -1
- data/README.md +15 -5
- data/lib/du_pretty/prettier.rb +11 -9
- data/lib/du_pretty/version.rb +1 -1
- 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: 137d8bb9256e03a3eaca29f905a6a4acdbeb10339073ae166d2c5fd493b78258
|
4
|
+
data.tar.gz: 4de639c8fe1a5916f780f4f35f01e0912aa3ed8ad8d8bd15a21e0d9b220a43df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f257d7ee71f32777544fc1211f19ea36ed9a41bfc1a3e15db5bc99cc3c2e1c765874a31fe04418795c29632473e20846d78c406f13c5eeaae899f64120faa0
|
7
|
+
data.tar.gz: bf69a945663420dc05e6aadcd5856e457e3b9e92faa7173518f912b5c6ecc2cc7904114400b799bf494fdcc3f969167ceb80914b3f379dc2a6061a96f68b265d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
[](https://codeclimate.com/github/nullnull/du_pretty/maintainability)
|
6
6
|
[](https://codeclimate.com/github/nullnull/du_pretty/test_coverage)
|
7
7
|
|
8
|
-
Show pretty print of `du`
|
8
|
+
Show pretty print of `du` outputs.
|
9
9
|
|
10
|
-
[](https://gyazo.com/75f461882b3d0ba01dce40c79de543dd)
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
```sh
|
@@ -19,19 +19,29 @@ $ gem install 'du_pretty'
|
|
19
19
|
$ du_pretty <path>
|
20
20
|
|
21
21
|
# specify max depth
|
22
|
-
$ du_pretty -d 2
|
22
|
+
$ du_pretty <path> -d 2
|
23
23
|
|
24
24
|
# Filter results of `du` by its file's size
|
25
|
-
$ du_pretty --size 10M
|
25
|
+
$ du_pretty <path> --size 10M
|
26
|
+
```
|
27
|
+
|
28
|
+
[](https://gyazo.com/e3668cda06afde799fee8d8cf16abaa2)
|
26
29
|
|
30
|
+
|
31
|
+
```sh
|
27
32
|
# Show results sorted by the file's size
|
28
|
-
$ du_pretty
|
33
|
+
$ du_pretty <path> --sort
|
34
|
+
```
|
35
|
+
|
36
|
+
[](https://gyazo.com/d8ddc6c2a12a80bf7d07eaf9d63aa0b0)
|
29
37
|
|
38
|
+
```sh
|
30
39
|
# help
|
31
40
|
$ du_pretty --help
|
32
41
|
```
|
33
42
|
|
34
43
|
|
44
|
+
|
35
45
|
## Development
|
36
46
|
```sh
|
37
47
|
# run
|
data/lib/du_pretty/prettier.rb
CHANGED
@@ -73,25 +73,27 @@ module DuPretty
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def pretty_byte
|
76
|
-
mb = @kbyte / 1024
|
76
|
+
mb = @kbyte * 1.0 / 1024
|
77
77
|
gb = mb / 1024
|
78
|
-
|
78
|
+
byte_format = ->(x) { x.to_i >= 10 ? x.to_i : x.round(1) }
|
79
|
+
f = ->(value, unit, color) { "#{byte_format.call(value)}#{unit} (#{percentage})".send(color) }
|
80
|
+
if gb >= 1.0
|
79
81
|
if gb > 10
|
80
|
-
|
82
|
+
f.call(gb, 'GB', :red)
|
81
83
|
else
|
82
|
-
|
84
|
+
f.call(gb, 'GB', :light_red)
|
83
85
|
end
|
84
|
-
elsif mb.
|
86
|
+
elsif mb >= 1.0
|
85
87
|
if mb > 500
|
86
|
-
|
88
|
+
f.call(mb, 'MB', :yellow)
|
87
89
|
else
|
88
|
-
|
90
|
+
f.call(mb, 'MB', :light_yellow)
|
89
91
|
end
|
90
92
|
else
|
91
93
|
if @kbyte > 500
|
92
|
-
|
94
|
+
f.call(@kbyte, 'KB', :green)
|
93
95
|
else
|
94
|
-
|
96
|
+
f.call(@kbyte, 'KB', :light_green)
|
95
97
|
end
|
96
98
|
end
|
97
99
|
end
|
data/lib/du_pretty/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: du_pretty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuma Narisawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|