|
34 | 34 | ### Usage
|
35 | 35 |
|
36 | 36 | ```
|
37 |
| -Usage: rainbowpath [-p PALETTE] [-s STYLE] [-S SEPARATOR] [-m METHOD] |
| 37 | +Usage: rainbowpath [-p PALETTE] [-s PALETTE] [-S SEPARATOR] [-m METHOD] |
| 38 | + [-M METHOD] [-o INDEX STYLE] [-O INDEX STYLE] |
38 | 39 | [-l] [-c] [-n] [-b] [-h] [-v] [PATH]
|
39 | 40 |
|
40 | 41 | Color path components using a palette.
|
41 | 42 |
|
42 | 43 | Options:
|
43 |
| - -p, --palette=PALETTE Semicolon-separated list of styles for |
44 |
| - path components |
45 |
| - -s, --separator=STYLE Style for path separators |
46 |
| - -S, --separator-string=SEPARATOR String used to separate path components |
47 |
| - in the output (defaults to '/') |
48 |
| - -m, --method=METHOD Method for selecting styles from palette. |
49 |
| - One of sequential, hash, random |
50 |
| - (defaults to sequential). |
51 |
| - -l, --leading Do not display leading path separator |
52 |
| - -c, --compact Replace home directory path prefix with ~ |
53 |
| - -n, --newline Do not append newline |
54 |
| - -b, --bash Escape control codes for use in Bash prompts |
55 |
| - -h, --help Display this help |
56 |
| - -v, --version Display version information |
| 44 | + -p, --palette PALETTE Semicolon separated list of styles for |
| 45 | + path components |
| 46 | + -s, --separator-palette PALETTE Semicolon separated list of styles for |
| 47 | + path separators. |
| 48 | + -S, --separator SEPARATOR String used to separate path components |
| 49 | + in the output (defaults to '/') |
| 50 | + -m, --method METHOD Method for selecting styles from palette. |
| 51 | + One of sequential, hash, random |
| 52 | + (defaults to sequential). |
| 53 | + -M, --separator-method METHOD Method for selecting styles from separator |
| 54 | + palette. One of sequential, hash, random |
| 55 | + (defaults to sequential). |
| 56 | + -o, --override INDEX STYLE Override style at the given index. This option |
| 57 | + can appear multiple times. |
| 58 | + -O, --separator-override INDEX STYLE Override separator style at the given index. |
| 59 | + This option can appear multiple times. |
| 60 | + -l, --leading Do not display leading path separator |
| 61 | + -c, --compact Replace home directory path prefix with ~ |
| 62 | + -n, --newline Do not append newline |
| 63 | + -b, --bash Escape control codes for use in Bash prompts |
| 64 | + -h, --help Display this help |
| 65 | + -v, --version Display version information |
57 | 66 | ```
|
58 | 67 |
|
59 | 68 | ### Use in a Bash prompt
|
@@ -90,13 +99,51 @@ separated by commas. The possible properties are:
|
90 | 99 | | `underlined` | Underlined text |
|
91 | 100 | | `blink` | Blinking text |
|
92 | 101 |
|
93 |
| -Where `COLOR` is an integer between 0 and 255. |
| 102 | +Where `COLOR` is an integer between 0 and 255 or one of: `black`, `red`, |
| 103 | +`green`, `yellow`, `blue`, `magenta`, `cyan`, `white`. |
94 | 104 |
|
95 |
| -For example, the following invocation will display the current working |
96 |
| -directory's path altering path components' styles between underlined green (2) |
97 |
| -and bold yellow (3) on magenta (5) background: |
| 105 | +For example, the following invocation will display the path of the current |
| 106 | +working directory altering styles of path components between underlined green |
| 107 | +text and bold yellow text on magenta background: |
98 | 108 |
|
99 | 109 | ``` shell
|
100 |
| -rainbowpath --palette 'fg=2,underlined;fg=3,bg=5,bold' |
| 110 | +rainbowpath --palette 'fg=green,underlined;fg=yellow,bg=magenta,bold' |
101 | 111 | ```
|
102 | 112 |
|
| 113 | +### Style Overrides |
| 114 | + |
| 115 | +`--override` and `--separator-override` options make it possible to selectively |
| 116 | +override the style of particular path component at a specific index. |
| 117 | + |
| 118 | +For example, the following command displays all the directory components of the |
| 119 | +path as blue, except the first one (index `0` "this") which will be displayed as |
| 120 | +yellow. |
| 121 | + |
| 122 | +``` shell |
| 123 | +rainbowpath -p 'fg=blue' -o 0 'fg=yellow' '/this/is/an/example/' |
| 124 | +``` |
| 125 | + |
| 126 | +Component indexes can also be negative, in which case they start at the end of |
| 127 | +the list of path components. For example, the following command will print |
| 128 | +"example" as yellow. |
| 129 | + |
| 130 | +``` shell |
| 131 | +rainbowpath -p 'fg=blue' -o -1 'fg=yellow' '/this/is/an/example/' |
| 132 | +``` |
| 133 | + |
| 134 | +Override styles are merged with the base style from the palette. For example, |
| 135 | +the following command will display example in blue bold font. |
| 136 | + |
| 137 | +``` shell |
| 138 | +rainbowpath -p 'fg=blue' -o -1 'bold' '/this/is/an/example/' |
| 139 | +``` |
| 140 | + |
| 141 | +Override styles are also able to revert style properties set by the base style. |
| 142 | +This can be achieved by prefixing the property name with a `!`. |
| 143 | + |
| 144 | +For example, the following command will print all path components in bold yellow |
| 145 | +font, except the last one which will be printed in the regular font: |
| 146 | + |
| 147 | +``` shell |
| 148 | +rainbowpath -p 'fg=yellow,bold' -o -1 '!fg,!bold' '/this/is/an/example/' |
| 149 | +``` |
0 commit comments