docs: update
This commit is contained in:
10
README.md
10
README.md
@@ -6,7 +6,7 @@
|
|||||||
This is handy when writing scripts in pure bash and `stty`/`tput` can’t be
|
This is handy when writing scripts in pure bash and `stty`/`tput` can’t be
|
||||||
called.
|
called.
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
get_term_size() {
|
get_term_size() {
|
||||||
# Usage: get_term_size
|
# Usage: get_term_size
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ get_term_size() {
|
|||||||
|
|
||||||
### Convert a hex color to RGB
|
### Convert a hex color to RGB
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
hex_to_rgb() {
|
hex_to_rgb() {
|
||||||
# Usage: hex_to_rgb "#FFFFFF"
|
# Usage: hex_to_rgb "#FFFFFF"
|
||||||
((r=16#${1:1:2}))
|
((r=16#${1:1:2}))
|
||||||
@@ -34,7 +34,7 @@ hex_to_rgb() {
|
|||||||
|
|
||||||
### Convert an RGB color to hex.
|
### Convert an RGB color to hex.
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
rgb_to_hex() {
|
rgb_to_hex() {
|
||||||
# Usage: rgb_to_hex "r" "g" "b"
|
# Usage: rgb_to_hex "r" "g" "b"
|
||||||
printf '#%02x%02x%02x\n' "$1" "$2" "$3"
|
printf '#%02x%02x%02x\n' "$1" "$2" "$3"
|
||||||
@@ -49,7 +49,7 @@ in place of the `date` command in a lot of cases.
|
|||||||
|
|
||||||
**NOTE:** Requires bash4+
|
**NOTE:** Requires bash4+
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
date() {
|
date() {
|
||||||
# Usage: date "format"
|
# Usage: date "format"
|
||||||
# See: 'man strftime' for format.
|
# See: 'man strftime' for format.
|
||||||
@@ -62,7 +62,7 @@ date() {
|
|||||||
|
|
||||||
Extract the directory from a file path.
|
Extract the directory from a file path.
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
dirname() {
|
dirname() {
|
||||||
# Usage: dirname "path"
|
# Usage: dirname "path"
|
||||||
printf ‘%s\n’ "${1%/*}/"
|
printf ‘%s\n’ "${1%/*}/"
|
||||||
|
|||||||
Reference in New Issue
Block a user