Commit 75f29a0
authored
feat: allow cli/ tool to read data from stdin (#108)
Read data from stdin if no '-i' argument is given
This is especially useful for binary data, which may not survive in an argument
list (e.g. due to the presence of NUL bytes).
The 'encode' and 'decode' commands are now exact inverses of each other, so data
will roundtrip correctly, e.g.
$ echo "hello world" | ./multibase encode | ./multibase decode
hello world
$ echo "hello world" | ./multibase encode | ./multibase decode | ./multibase encode
z2yGEbwRFyhPZZckJm
$ echo "hello world" | ./multibase encode
z2yGEbwRFyhPZZckJm
Also avoid extra newlines, or additions like "Result: ", since they make the command
less useful.1 parent ea6c3a9 commit 75f29a0
1 file changed
+30
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
| |||
119 | 140 | | |
120 | 141 | | |
121 | 142 | | |
122 | | - | |
| 143 | + | |
123 | 144 | | |
124 | 145 | | |
125 | 146 | | |
126 | 147 | | |
127 | 148 | | |
128 | | - | |
129 | | - | |
| 149 | + | |
| 150 | + | |
130 | 151 | | |
131 | 152 | | |
0 commit comments