updated stuffs
This commit is contained in:
parent
aad676ae04
commit
4bdb65b4b8
14 changed files with 127 additions and 39 deletions
15
bin/ansi
15
bin/ansi
|
@ -427,6 +427,13 @@ ansi::invisible() {
|
|||
}
|
||||
|
||||
ansi::isAnsiSupported() {
|
||||
# Optionally override detection logic
|
||||
# to support post processors that interpret color codes _after_ output is generated.
|
||||
# Use environment variable "ANSI_FORCE_SUPPORT=<anything>" to enable the override.
|
||||
if [[ -n "${ANSI_FORCE_SUPPORT-}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if hash tput &> /dev/null; then
|
||||
if [[ "$(tput colors)" -lt 8 ]]; then
|
||||
return 1
|
||||
|
@ -1513,6 +1520,12 @@ ansi() {
|
|||
m65="65;"
|
||||
;;
|
||||
|
||||
--ideogram-stress)
|
||||
$supported && ansi::ideogramStress
|
||||
restoreText=true
|
||||
m65="65;"
|
||||
;;
|
||||
|
||||
--reset-ideogram)
|
||||
$supported && ansi::noIdeogram
|
||||
;;
|
||||
|
@ -1603,7 +1616,7 @@ ansi() {
|
|||
fi
|
||||
|
||||
if $restoreText; then
|
||||
m="$m10$m22$m23$m24$m25$m27$m28$m29$m$m39$m49$m54$m55$m65"
|
||||
m="$m10$m22$m23$m24$m25$m27$m28$m29$m39$m49$m54$m55$m65"
|
||||
printf '%s%sm' "$ANSI_CSI" "${m%;}"
|
||||
fi
|
||||
fi
|
||||
|
|
13
bin/desk
13
bin/desk
|
@ -30,8 +30,11 @@ Usage:
|
|||
Activate a desk. Extra arguments are passed onto shell. If called with
|
||||
no arguments, look for a Deskfile in the current directory. If not a
|
||||
recognized desk, try as a path to directory containing a Deskfile.
|
||||
$PROGRAM run <desk-name> <cmd>
|
||||
Run a command within a desk's environment then exit. Think '\$SHELL -c'.
|
||||
$PROGRAM run <desk-name> '<cmd>'
|
||||
$PROGRAM run <desk-name> <cmd> <arg>...
|
||||
Run a command within a desk's environment then exit. In the first form
|
||||
shell expansion is performed. In the second form, the argument vector
|
||||
is executed as is.
|
||||
$PROGRAM edit [desk-name]
|
||||
Edit (or create) a deskfile with the name specified, otherwise
|
||||
edit the active deskfile.
|
||||
|
@ -138,7 +141,11 @@ cmd_go() {
|
|||
cmd_run() {
|
||||
local TODESK="$1"
|
||||
shift;
|
||||
cmd_go "$TODESK" -ic "$@"
|
||||
if [ $# -eq 1 ]; then
|
||||
cmd_go "$TODESK" -ic "$1"
|
||||
else
|
||||
cmd_go "$TODESK" -ic '"$@"' -- "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
|
47
bin/mo
47
bin/mo
|
@ -11,12 +11,18 @@
|
|||
#/
|
||||
#/ Simple usage:
|
||||
#/
|
||||
#/ mo [--false] [--help] [--source=FILE] filenames...
|
||||
#/ mo [OPTIONS] filenames...
|
||||
#/
|
||||
#/ --fail-not-set - Fail upon expansion of an unset variable.
|
||||
#/ --false - Treat the string "false" as empty for conditionals.
|
||||
#/ --help - This message.
|
||||
#/ --source=FILE - Load FILE into the environment before processing templates.
|
||||
#/ Options:
|
||||
#/
|
||||
#/ -u, --fail-not-set
|
||||
#/ - Fail upon expansion of an unset variable.
|
||||
#/ -e, --false
|
||||
#/ - Treat the string "false" as empty for conditionals.
|
||||
#/ -h, --help
|
||||
#/ - This message.
|
||||
#/ -s=FILE, --source=FILE
|
||||
#/ - Load FILE into the environment before processing templates.
|
||||
#
|
||||
# Mo is under a MIT style licence with an additional non-advertising clause.
|
||||
# See LICENSE.md for the full text.
|
||||
|
@ -32,14 +38,17 @@
|
|||
# --allow-function-arguments
|
||||
# - Permit functions in templates to be called with additional
|
||||
# arguments. This puts template data directly in to the path
|
||||
# of an eval statement. Use with caution.
|
||||
# --fail-not-set - Fail upon expansion of an unset variable. Default behavior
|
||||
# of an eval statement. Use with caution. Not listed in the
|
||||
# help because it only makes sense when mo is sourced.
|
||||
# -u, --fail-not-set
|
||||
# - Fail upon expansion of an unset variable. Default behavior
|
||||
# is to silently ignore and expand into empty string.
|
||||
# --false - Treat "false" as an empty value. You may set the
|
||||
# -e, --false - Treat "false" as an empty value. You may set the
|
||||
# MO_FALSE_IS_EMPTY environment variable instead to a non-empty
|
||||
# value to enable this behavior.
|
||||
# --help - Display a help message.
|
||||
# --source=FILE - Source a file into the environment before processint
|
||||
# -h, --help - Display a help message.
|
||||
# -s=FILE, --source=FILE
|
||||
# - Source a file into the environment before processint
|
||||
# template files.
|
||||
# -- - Used to indicate the end of options. You may optionally
|
||||
# use this when filenames may start with two hyphens.
|
||||
|
@ -53,6 +62,7 @@
|
|||
# options and arguments. This puts the content from the
|
||||
# template directly into an eval statement. Use with
|
||||
# extreme care.
|
||||
# MO_FUNCTION_ARGS - Arguments passed to the function
|
||||
# MO_FAIL_ON_UNSET - When set to a non-empty value, expansion of an unset
|
||||
# env variable will be aborted with an error.
|
||||
# MO_FALSE_IS_EMPTY - When set to a non-empty value, the string "false"
|
||||
|
@ -89,18 +99,22 @@ mo() (
|
|||
MO_ALLOW_FUNCTION_ARGUMENTS=true
|
||||
;;
|
||||
|
||||
--fail-not-set)
|
||||
-u | --fail-not-set)
|
||||
# shellcheck disable=SC2030
|
||||
MO_FAIL_ON_UNSET=true
|
||||
;;
|
||||
|
||||
--false)
|
||||
-e | --false)
|
||||
# shellcheck disable=SC2030
|
||||
MO_FALSE_IS_EMPTY=true
|
||||
;;
|
||||
|
||||
--source=*)
|
||||
f2source="${arg#--source=}"
|
||||
-s=* | --source=*)
|
||||
if [[ "$arg" == --source=* ]]; then
|
||||
f2source="${arg#--source=}"
|
||||
else
|
||||
f2source="${arg#-s=}"
|
||||
fi
|
||||
|
||||
if [[ -f "$f2source" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
|
@ -141,16 +155,17 @@ mo() (
|
|||
#
|
||||
# Returns nothing.
|
||||
moCallFunction() {
|
||||
local moArgs
|
||||
local moArgs moFunctionArgs
|
||||
|
||||
moArgs=()
|
||||
moTrimWhitespace moFunctionArgs "$3"
|
||||
|
||||
# shellcheck disable=SC2031
|
||||
if [[ -n "${MO_ALLOW_FUNCTION_ARGUMENTS-}" ]]; then
|
||||
moArgs=$3
|
||||
fi
|
||||
|
||||
echo -n "$2" | eval "$1" "$moArgs"
|
||||
echo -n "$2" | MO_FUNCTION_ARGS="$moFunctionArgs" eval "$1" "$moArgs"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,4 +18,4 @@ curl_close($curl);
|
|||
|
||||
$json = json_decode($return, true);
|
||||
|
||||
if(isset($json['info'])) echo("Result: ${json['info']}");
|
||||
if(isset($json['info'])) echo("Result: ${json['info']}");
|
|
@ -27,7 +27,7 @@ _revolver_spinners=(
|
|||
'growHorizontal' '0.12 ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▊ ▋ ▌ ▍ ▎'
|
||||
'balloon' '0.14 " " "." "o" "O" "@" "*" " "'
|
||||
'balloon2' '0.12 . o O ° O o .'
|
||||
'noise' '▓ ▒ ░'
|
||||
'noise' '0.14 ▓ ▒ ░'
|
||||
'bounce' '0.1 ⠁ ⠂ ⠄ ⠂'
|
||||
'boxBounce' '0.12 ▖ ▘ ▝ ▗'
|
||||
'boxBounce2' '0.1 ▌ ▀ ▐ ▄'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue