-
Notifications
You must be signed in to change notification settings - Fork 0
/
dahlia
executable file
·43 lines (32 loc) · 1.01 KB
/
dahlia
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# shellcheck disable=2016
source "$(dirname -- "$(readlink -f -- "$0")")"/lib/lib.sh
show_help() {
echo "\
Dahlia — a simple text formatting package, inspired by the game Minecraft.
Usage:
dahlia [--] TEXT
parse the TEXT and color it
dahlia {clean|clean_ansi} TEXT
remove Dahlia/ANSI codes from TEXT
dahlia test
print short test string
dahlia {--help|help}
print this help
Configuration via environment variables:
DAHLIA_DEPTH - color depth
either case insensitive string AUTO, TTY, LOW, MEDIUM or HIGH or number of bits 0, 3, 4, 8, 24
(default or AUTO is tries to infer the best based on the terminal)
DAHLIA_MARKER - specify what marker to use (default is &)
DAHLIA_AUTO_RESET - if not 0 auto add reset (default is 1)
Respects NO_COLOR environment variable.
"
}
case "$1" in
'' | --help | help) show_help ;;
--) dahlia_convert "${@:2}" ;;
test) dahlia_test ;;
clean) dahlia_clean "${@:2}" ;;
clean_ansi) dahlia_clean_ansi "${@:2}" ;;
*) dahlia_convert "$@" ;;
esac