reverse coloring variable

This commit is contained in:
ville rantanen
2018-12-23 11:10:49 +02:00
parent 3417d51326
commit 3fd0d1f12e
2 changed files with 29 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
#!/bin/bash
_qColVersion() { echo Version 2018.10.23.0; }
_qColVersion() { echo Version 2018.12.23.0; }
_qColHelp() {
_qColVersion
@@ -30,7 +30,13 @@ Examples:
_qCol export _c
echo -e ${_cG}Title${_cZ}
Run qolop as script to print ANSI code table
Run qolop as script to print ANSI code table, or evaluate commands
qolop eval "_qCol G; printf hello; _qCol z" | qolop export
The first command produces string with ANSI commands, the
second will escape the escape characters, so you can copy/paste
it in to another echo -e command.
'
}
@@ -123,6 +129,9 @@ _qPos() {
[[ "$1" = "linedown" ]] && { printf '\033['${n}'F'; return; }
[[ "$1" = "col" ]] && { printf '\033['${n}'G'; return; }
[[ "$1" = "abs" ]] && { printf '\033['${n}';'${x}'H'; return; }
echo "Command missing: save, restore, up, down, right, left, lineup, linedown, col, abs" >&2
echo "Directional commands take one argument, abs uses two (row, col)" >&2
return 1
}
_qClr() {
@@ -170,6 +179,17 @@ if [[ "$0" = "${BASH_SOURCE[0]}" ]]; then
rm -f "$TMPFILE"
exit 0
} # end update
[[ "$1" = "eval" ]] && {
set -e
eval "$@"
exit
}
[[ "$1" = "export" ]] && {
cat - | sed s/$'\e'/\\\\033/g
echo ''
exit
}
_qColHelp
[[ "$1" = *"help" ]] && exit
[[ "$1" = "-h" ]] && exit