fd 0.5.0 → 1.0.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/.github/workflows/main.yml +1 -1
- data/README.md +25 -21
- data/fd.gemspec +2 -1
- data/images/usage_example.png +0 -0
- data/lib/fd/version.rb +1 -1
- data/lib/fd.rb +9 -1
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 867ca2b5b5c93216fffa4486285d16f53a066f1b98359c18781c954abdc42071
|
4
|
+
data.tar.gz: f56557d88d4e1ff44cc5702e6fa2dc7f24c518f7035b3e1ed677c378b678e98a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee0824ce6e7b1cefa11dba4ffbd06b514e8f3f7f82d56d0f77c5aa0003dc85df293c5dbd04bbb0d9c67f03db4e2d00f89e8466c1a67a45a4560fb76ab808462
|
7
|
+
data.tar.gz: f8a1ac2e48b72124faa67d9667ba37694b1e26e480a1a278c7f2f95d0aa9f10c2bd788475a7849f7794a87a3b2c76210a118023b9ba55a39e33550307e80c408
|
data/.github/workflows/main.yml
CHANGED
data/README.md
CHANGED
@@ -42,37 +42,41 @@ You can pass _file names_ on the command line:
|
|
42
42
|
fd [-w number] [file_names]
|
43
43
|
```
|
44
44
|
|
45
|
-
For example:
|
45
|
+
For example (without colour highlighting of invisible characters):
|
46
46
|
|
47
47
|
```bash
|
48
48
|
> echo "Bacon ipsum dolor amet short ribs flank irure filet mignon brisket buffalo est porchetta." > some_file
|
49
|
-
> fd -w 7 some_file
|
49
|
+
> ~/dev/fd ᚠ main > fd -w 7 some_file
|
50
50
|
some_file
|
51
|
-
42 61 63 6f 6e 20 69 |
|
52
|
-
70 73 75 6d 20 64 6f |
|
53
|
-
6c 6f 72 20 61 6d 65 |
|
54
|
-
74 20 73 68 6f 72 74 |
|
55
|
-
20 72 69 62 73 20 66 |
|
56
|
-
6c 61 6e 6b 20 69 72 |
|
57
|
-
75 72 65 20 66 69 6c |
|
58
|
-
65 74 20 6d 69 67 6e |
|
59
|
-
6f 6e 20 62 72 69 73 |
|
60
|
-
6b 65 74 20 62 75 66 |
|
61
|
-
66 61 6c 6f 20 65 73 |
|
62
|
-
74 20 70 6f 72 63 68 |
|
63
|
-
65 74 74 61 2e 0a |
|
51
|
+
42 61 63 6f 6e 20 69 | B a c o n ␠ i
|
52
|
+
70 73 75 6d 20 64 6f | p s u m ␠ d o
|
53
|
+
6c 6f 72 20 61 6d 65 | l o r ␠ a m e
|
54
|
+
74 20 73 68 6f 72 74 | t ␠ s h o r t
|
55
|
+
20 72 69 62 73 20 66 | ␠ r i b s ␠ f
|
56
|
+
6c 61 6e 6b 20 69 72 | l a n k ␠ i r
|
57
|
+
75 72 65 20 66 69 6c | u r e ␠ f i l
|
58
|
+
65 74 20 6d 69 67 6e | e t ␠ m i g n
|
59
|
+
6f 6e 20 62 72 69 73 | o n ␠ b r i s
|
60
|
+
6b 65 74 20 62 75 66 | k e t ␠ b u f
|
61
|
+
66 61 6c 6f 20 65 73 | f a l o ␠ e s
|
62
|
+
74 20 70 6f 72 63 68 | t ␠ p o r c h
|
63
|
+
65 74 74 61 2e 0a | e t t a . ␊
|
64
64
|
```
|
65
65
|
|
66
|
-
|
66
|
+
Here's a screenshot of a zsh session that shows the highlighting:
|
67
|
+
|
68
|
+

|
69
|
+
|
70
|
+
You can also pipe input from STDIN:
|
67
71
|
|
68
72
|
```bash
|
69
73
|
> echo "Put something into STDIN" | fd -w 5
|
70
74
|
STDIN
|
71
|
-
50 75 74 20 73 |
|
72
|
-
6f 6d 65 74 68 |
|
73
|
-
69 6e 67 20 69 |
|
74
|
-
6e 74 6f 20 53 |
|
75
|
-
54 44 49 4e 0a |
|
75
|
+
50 75 74 20 73 | P u t ␠ s
|
76
|
+
6f 6d 65 74 68 | o m e t h
|
77
|
+
69 6e 67 20 69 | i n g ␠ i
|
78
|
+
6e 74 6f 20 53 | n t o ␠ S
|
79
|
+
54 44 49 4e 0a | T D I N ␊
|
76
80
|
```
|
77
81
|
|
78
82
|
## Development
|
data/fd.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Stephan Kämper']
|
9
9
|
spec.email = ['the.tester@seasidetesting.com']
|
10
10
|
|
11
|
-
spec.summary = 'fd is a simple
|
11
|
+
spec.summary = 'fd is a simple tool to dump file contents in binary & text format side by side'
|
12
12
|
spec.description = 'fd prints the given file in two columns: Hex values in the left column and the textual representations in the right column.'
|
13
13
|
spec.homepage = 'https://github.com/s2k/fd'
|
14
14
|
spec.license = 'MIT'
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'simplecov'
|
31
31
|
spec.add_development_dependency 'terminal-notifier'
|
32
32
|
spec.add_development_dependency 'terminal-notifier-guard'
|
33
|
+
spec.add_development_dependency 'mutex_m'
|
33
34
|
|
34
35
|
# Specify which files should be added to the gem when it is released.
|
35
36
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
Binary file
|
data/lib/fd/version.rb
CHANGED
data/lib/fd.rb
CHANGED
@@ -7,6 +7,8 @@ require_relative 'fd/version'
|
|
7
7
|
class Fd
|
8
8
|
class Error < StandardError; end
|
9
9
|
|
10
|
+
ESCAPE_CHARACTERS = %w[␀ ␇ ␈ ␉ ␊ ␋ ␌ ␍ ␡ ␛ ␠]
|
11
|
+
|
10
12
|
attr_reader :line_length, :char_table
|
11
13
|
|
12
14
|
# _line_length_ sets how many characters are displayed per @line.
|
@@ -44,6 +46,10 @@ class Fd
|
|
44
46
|
@char_table[32] = '␠'
|
45
47
|
end
|
46
48
|
|
49
|
+
def add_esc_sequence(chr)
|
50
|
+
"\e[31m#{chr}\e[0m"
|
51
|
+
end
|
52
|
+
|
47
53
|
# dumps the given file _file_name_ to stdout.
|
48
54
|
def dump(content)
|
49
55
|
raise "Not the expected encoding of UFT-8, got #{content.encoding}" unless content.encoding == Encoding::UTF_8
|
@@ -104,6 +110,8 @@ class Fd
|
|
104
110
|
end
|
105
111
|
|
106
112
|
def print_single_line
|
107
|
-
puts("#{format("%#{(3 * line_length) - 1}s", hex_values.join(' '))} |#{format("%#{2 * line_length}s", line)}"
|
113
|
+
puts("#{format("%#{(3 * line_length) - 1}s", hex_values.join(' '))} |#{format("%#{2 * line_length}s", line)}".
|
114
|
+
gsub(/([#{ESCAPE_CHARACTERS.join('')}])/, add_esc_sequence('\1'))
|
115
|
+
)
|
108
116
|
end
|
109
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Kämper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard-bundler
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: mutex_m
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
description: 'fd prints the given file in two columns: Hex values in the left column
|
154
168
|
and the textual representations in the right column.'
|
155
169
|
email:
|
@@ -173,6 +187,7 @@ files:
|
|
173
187
|
- bin/fd
|
174
188
|
- bin/setup
|
175
189
|
- fd.gemspec
|
190
|
+
- images/usage_example.png
|
176
191
|
- lib/fd.rb
|
177
192
|
- lib/fd/version.rb
|
178
193
|
homepage: https://github.com/s2k/fd
|
@@ -198,9 +213,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
213
|
- !ruby/object:Gem::Version
|
199
214
|
version: '0'
|
200
215
|
requirements: []
|
201
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.5.3
|
202
217
|
signing_key:
|
203
218
|
specification_version: 4
|
204
|
-
summary: fd is a simple
|
205
|
-
|
219
|
+
summary: fd is a simple tool to dump file contents in binary & text format side by
|
220
|
+
side
|
206
221
|
test_files: []
|