|
1 | 1 | # smlr |
2 | | -Truncates stdin to a maximum fixed size, abbreviating the output if over the specified length. |
| 2 | +Truncates `stdin` to a maximum fixed size, abbreviating the output if over the specified length. For example, make a giant git branch name more manageable for use in `PS1`. |
3 | 3 |
|
4 | 4 | #### Usage |
5 | 5 | `[source] | smlr [-s SIZE] [-a ALIGNMENT]` |
6 | 6 | * `-s`: Size of output. If equal or greater than input, input is relayed to s unchanged"). Default value is 5. |
7 | | -* `-a`: Alignment of output. Can be either `left` or `right`. Default value is middle. |
| 7 | +* `-a`: Alignment of output. Can be either middle (if option is omitted), `left` or `right`. Default is middle alignment. |
8 | 8 |
|
9 | 9 | #### Examples |
10 | | -Bring your git branch down to a fixed-size |
| 10 | +Bring your git branch down to a fixed-size: |
11 | 11 | ``` |
12 | 12 | > git rev-parse --abbrev-ref HEAD | smlr -s 10 |
13 | 13 | > feat...-13 |
14 | 14 | ``` |
15 | | -Deal with too many letters |
| 15 | +Deal with too many letters. Sometimes there are too many: |
16 | 16 | ``` |
17 | 17 | > echo "abcdefghijkl" | smlr -s 10 -a right |
18 | 18 | > ...fghijkl |
| 19 | +> echo "abcdefghijkl" | smlr -s 10 -a left |
| 20 | +> abcdefg... |
19 | 21 | ``` |
20 | | -A date string that's just too long |
| 22 | +A date string that's just too long: |
21 | 23 | ``` |
22 | 24 | > date | smlr -s 10 |
23 | 25 | > Thu ...017 |
24 | 26 | ``` |
25 | | -Repeat the string if it turns out to be equal, or smaller than, the size given |
| 27 | +Repeat the string if it turns out to be equal, or smaller than, the size given: |
26 | 28 | ``` |
27 | 29 | > echo "abc" | smlr -s 5 |
28 | 30 | > abc |
29 | 31 | ``` |
30 | 32 |
|
31 | 33 | #### Installation |
32 | | -Just run a `make` to build it. If everything works out, you'll have a binary in `build/rel/smlr`. Symlink or copy that sucker to a path directory, such as `/usr/bin`. |
| 34 | +Clone the repo and run a `make` to build it. If everything works out, you'll have a binary in `build/rel/smlr`. Symlink or copy that sucker to a path directory, such as `/usr/bin`. |
0 commit comments