Remove 'selector-16' which the macos emoji picker inserts, and handle it being present
This commit is contained in:
54
⚡
Normal file
54
⚡
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main() {
|
||||
redefine-functions-defined-with-selector-16
|
||||
if [[ $(type -t "⚡$1") == "function" ]]; then
|
||||
⚡$1
|
||||
else
|
||||
⚡help
|
||||
fi
|
||||
}
|
||||
|
||||
redefine-functions-defined-with-selector-16() {
|
||||
for function in $(compgen -c $(printf "⚡\uFE0F")); do
|
||||
original_definition="$(typeset -f $function)"
|
||||
eval "${original_definition//$(printf "⚡\uFE0F")/⚡}"
|
||||
unset $function
|
||||
done
|
||||
}
|
||||
|
||||
⚡help() {
|
||||
_help-line "Show this list" "$@"
|
||||
echo Usage: "$0" SUBCOMMAND
|
||||
echo
|
||||
echo "Available subcommands:"
|
||||
for subcommand in $(_subcommands); do
|
||||
if [[ $(type ⚡$subcommand) =~ _help-line ]]; then
|
||||
printf "\t%-20s - %s\n" "$subcommand" "$(⚡$subcommand help-line)"
|
||||
else
|
||||
printf "\t%-20s\n" $subcommand
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_subcommands() {
|
||||
compgen -c ⚡ | cut -c2-
|
||||
}
|
||||
|
||||
_help-line() {
|
||||
if [[ "$#" == 2 && "$2" == "help-line" ]]; then
|
||||
echo "$1" && exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
_good-message() {
|
||||
echo -e "\e[32m$@\e[0m"
|
||||
}
|
||||
|
||||
_bad-message() {
|
||||
echo -e "\e[31m$@\e[0m"
|
||||
}
|
||||
|
||||
[[ $(type -t _verify-prerequisites) == "function" ]] && ! _verify-prerequisites && exit 1
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user