updated stuffs

This commit is contained in:
Nikolas Weger 2019-11-07 23:20:34 +01:00
parent aad676ae04
commit 4bdb65b4b8
14 changed files with 127 additions and 39 deletions

View file

@ -427,6 +427,13 @@ ansi::invisible() {
} }
ansi::isAnsiSupported() { 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 hash tput &> /dev/null; then
if [[ "$(tput colors)" -lt 8 ]]; then if [[ "$(tput colors)" -lt 8 ]]; then
return 1 return 1
@ -1513,6 +1520,12 @@ ansi() {
m65="65;" m65="65;"
;; ;;
--ideogram-stress)
$supported && ansi::ideogramStress
restoreText=true
m65="65;"
;;
--reset-ideogram) --reset-ideogram)
$supported && ansi::noIdeogram $supported && ansi::noIdeogram
;; ;;
@ -1603,7 +1616,7 @@ ansi() {
fi fi
if $restoreText; then 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%;}" printf '%s%sm' "$ANSI_CSI" "${m%;}"
fi fi
fi fi

View file

@ -30,8 +30,11 @@ Usage:
Activate a desk. Extra arguments are passed onto shell. If called with 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 no arguments, look for a Deskfile in the current directory. If not a
recognized desk, try as a path to directory containing a Deskfile. recognized desk, try as a path to directory containing a Deskfile.
$PROGRAM run <desk-name> <cmd> $PROGRAM run <desk-name> '<cmd>'
Run a command within a desk's environment then exit. Think '\$SHELL -c'. $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] $PROGRAM edit [desk-name]
Edit (or create) a deskfile with the name specified, otherwise Edit (or create) a deskfile with the name specified, otherwise
edit the active deskfile. edit the active deskfile.
@ -138,7 +141,11 @@ cmd_go() {
cmd_run() { cmd_run() {
local TODESK="$1" local TODESK="$1"
shift; shift;
cmd_go "$TODESK" -ic "$@" if [ $# -eq 1 ]; then
cmd_go "$TODESK" -ic "$1"
else
cmd_go "$TODESK" -ic '"$@"' -- "$@"
fi
} }

47
bin/mo
View file

@ -11,12 +11,18 @@
#/ #/
#/ Simple usage: #/ Simple usage:
#/ #/
#/ mo [--false] [--help] [--source=FILE] filenames... #/ mo [OPTIONS] filenames...
#/ #/
#/ --fail-not-set - Fail upon expansion of an unset variable. #/ Options:
#/ --false - Treat the string "false" as empty for conditionals. #/
#/ --help - This message. #/ -u, --fail-not-set
#/ --source=FILE - Load FILE into the environment before processing templates. #/ - 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. # Mo is under a MIT style licence with an additional non-advertising clause.
# See LICENSE.md for the full text. # See LICENSE.md for the full text.
@ -32,14 +38,17 @@
# --allow-function-arguments # --allow-function-arguments
# - Permit functions in templates to be called with additional # - Permit functions in templates to be called with additional
# arguments. This puts template data directly in to the path # arguments. This puts template data directly in to the path
# of an eval statement. Use with caution. # of an eval statement. Use with caution. Not listed in the
# --fail-not-set - Fail upon expansion of an unset variable. Default behavior # 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. # 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 # MO_FALSE_IS_EMPTY environment variable instead to a non-empty
# value to enable this behavior. # value to enable this behavior.
# --help - Display a help message. # -h, --help - Display a help message.
# --source=FILE - Source a file into the environment before processint # -s=FILE, --source=FILE
# - Source a file into the environment before processint
# template files. # template files.
# -- - Used to indicate the end of options. You may optionally # -- - Used to indicate the end of options. You may optionally
# use this when filenames may start with two hyphens. # use this when filenames may start with two hyphens.
@ -53,6 +62,7 @@
# options and arguments. This puts the content from the # options and arguments. This puts the content from the
# template directly into an eval statement. Use with # template directly into an eval statement. Use with
# extreme care. # 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 # MO_FAIL_ON_UNSET - When set to a non-empty value, expansion of an unset
# env variable will be aborted with an error. # env variable will be aborted with an error.
# MO_FALSE_IS_EMPTY - When set to a non-empty value, the string "false" # MO_FALSE_IS_EMPTY - When set to a non-empty value, the string "false"
@ -89,18 +99,22 @@ mo() (
MO_ALLOW_FUNCTION_ARGUMENTS=true MO_ALLOW_FUNCTION_ARGUMENTS=true
;; ;;
--fail-not-set) -u | --fail-not-set)
# shellcheck disable=SC2030 # shellcheck disable=SC2030
MO_FAIL_ON_UNSET=true MO_FAIL_ON_UNSET=true
;; ;;
--false) -e | --false)
# shellcheck disable=SC2030 # shellcheck disable=SC2030
MO_FALSE_IS_EMPTY=true MO_FALSE_IS_EMPTY=true
;; ;;
--source=*) -s=* | --source=*)
f2source="${arg#--source=}" if [[ "$arg" == --source=* ]]; then
f2source="${arg#--source=}"
else
f2source="${arg#-s=}"
fi
if [[ -f "$f2source" ]]; then if [[ -f "$f2source" ]]; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
@ -141,16 +155,17 @@ mo() (
# #
# Returns nothing. # Returns nothing.
moCallFunction() { moCallFunction() {
local moArgs local moArgs moFunctionArgs
moArgs=() moArgs=()
moTrimWhitespace moFunctionArgs "$3"
# shellcheck disable=SC2031 # shellcheck disable=SC2031
if [[ -n "${MO_ALLOW_FUNCTION_ARGUMENTS-}" ]]; then if [[ -n "${MO_ALLOW_FUNCTION_ARGUMENTS-}" ]]; then
moArgs=$3 moArgs=$3
fi fi
echo -n "$2" | eval "$1" "$moArgs" echo -n "$2" | MO_FUNCTION_ARGS="$moFunctionArgs" eval "$1" "$moArgs"
} }

View file

@ -18,4 +18,4 @@ curl_close($curl);
$json = json_decode($return, true); $json = json_decode($return, true);
if(isset($json['info'])) echo("Result: ${json['info']}"); if(isset($json['info'])) echo("Result: ${json['info']}");

View file

@ -27,7 +27,7 @@ _revolver_spinners=(
'growHorizontal' '0.12 ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▊ ▋ ▌ ▍ ▎' 'growHorizontal' '0.12 ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▊ ▋ ▌ ▍ ▎'
'balloon' '0.14 " " "." "o" "O" "@" "*" " "' 'balloon' '0.14 " " "." "o" "O" "@" "*" " "'
'balloon2' '0.12 . o O ° O o .' 'balloon2' '0.12 . o O ° O o .'
'noise' '▓ ▒ ░' 'noise' '0.14 ▓ ▒ ░'
'bounce' '0.1 ⠁ ⠂ ⠄ ⠂' 'bounce' '0.1 ⠁ ⠂ ⠄ ⠂'
'boxBounce' '0.12 ▖ ▘ ▝ ▗' 'boxBounce' '0.12 ▖ ▘ ▝ ▗'
'boxBounce2' '0.1 ▌ ▀ ▐ ▄' 'boxBounce2' '0.1 ▌ ▀ ▐ ▄'

View file

@ -6,7 +6,6 @@ brewpr="$(/home/linuxbrew/.linuxbrew/bin/brew --prefix)"
gembin="$(ruby -e "puts Gem.user_dir")/bin" gembin="$(ruby -e "puts Gem.user_dir")/bin"
BASHER_SHELL=zsh BASHER_SHELL=zsh
BASHER_ROOT=/home/eeleater/.basher BASHER_ROOT=/home/eeleater/.basher
FN_API_URL=https://faas.eeleater.org
# Path # Path
path=(${brewpr}/sbin ${brewpr}/bin) # Homebrew path=(${brewpr}/sbin ${brewpr}/bin) # Homebrew
@ -21,9 +20,6 @@ if pacman -Qm android-sdk-build-tools &>/dev/null; then
path+=(/opt/android-sdk/build-tools/${asdkver}); # Android SDK path+=(/opt/android-sdk/build-tools/${asdkver}); # Android SDK
fi fi
if test -d /games; then
path+=(/games/weidu/bin/amd64)
fi
path+=(/opt/phalcon-devtools) path+=(/opt/phalcon-devtools)
PTOOLSPATH="/opt/phalcon-devtools/" PTOOLSPATH="/opt/phalcon-devtools/"
@ -46,12 +42,8 @@ fpath+=(${brewpr}/share/zsh/site-functions)
fpath+=(${dotlib}/local) fpath+=(${dotlib}/local)
fpath+=(${BASHER_ROOT}/cellar/completions/zsh) fpath+=(${BASHER_ROOT}/cellar/completions/zsh)
# IPFS
IPFS_PATH=/var/lib/ipfs/repo
VAULT_ADDR=http://127.0.0.1:8200
# Actually export # Actually export
export dotlib dotcfg brewpr gembin PATH MANPATH INFOPATH EDITOR XDG_DATA_DIRS PTOOLSPATH IPFSPATH VAULT_ADDR FN_API_URL export dotlib dotcfg brewpr gembin PATH MANPATH INFOPATH EDITOR XDG_DATA_DIRS PTOOLSPATH
# Reload all Prompts # Reload all Prompts
autoload -U promptinit && promptinit autoload -U promptinit && promptinit

View file

@ -1,4 +1,4 @@
export ZSH="${dotlib}/ohmyzsh" export ZSH="${dotlib}/ohmyzsh"
DISABLE_AUTO_UPDATE="true" DISABLE_AUTO_UPDATE="true"
ZSH_DISABLE_COMPFIX="true" ZSH_DISABLE_COMPFIX="true"
source ${ZSH}/oh-my-zsh.sh source ${ZSH}/oh-my-zsh.sh

View file

@ -1,4 +1,4 @@
alias brews='brew list -1' alias brews='brew list -1'
alias bubo='brew update && brew outdated' alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup' alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc' alias bubu='bubo && bubc'

View file

@ -56,6 +56,62 @@ if (( $+commands[yaourt] )); then
fi fi
fi fi
if (( $+commands[yay] )); then
alias yaconf='yay -Pg'
alias yaupg='yay -Syu'
alias yasu='yay -Syu --noconfirm'
alias yain='yay -S'
alias yains='yay -U'
alias yare='yay -R'
alias yarem='yay -Rns'
alias yarep='yay -Si'
alias yareps='yay -Ss'
alias yaloc='yay -Qi'
alias yalocs='yay -Qs'
alias yalst='yay -Qe'
alias yaorph='yay -Qtd'
alias yainsd='yay -S --asdeps'
alias yamir='yay -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias yaupd='yay -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias yaupd='yay -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias yaupd='yay -Sy && sudo aur'
else
alias yaupd='yay -Sy'
fi
fi
if (( $+commands[pacaur] )); then
alias paupg='pacaur -Syu'
alias pasu='pacaur -Syu --noconfirm'
alias pain='pacaur -S'
alias pains='pacaur -U'
alias pare='pacaur -R'
alias parem='pacaur -Rns'
alias parep='pacaur -Si'
alias pareps='pacaur -Ss'
alias paloc='pacaur -Qi'
alias palocs='pacaur -Qs'
alias palst='pacaur -Qe'
alias paorph='pacaur -Qtd'
alias painsd='pacaur -S --asdeps'
alias pamir='pacaur -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias paupd='pacaur -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias paupd='pacaur -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias paupd='pacaur -Sy && sudo aur'
else
alias paupd='pacaur -Sy'
fi
fi
if (( $+commands[trizen] )); then if (( $+commands[trizen] )); then
function upgrade() { function upgrade() {
trizen -Syu trizen -Syu
@ -68,12 +124,17 @@ elif (( $+commands[yaourt] )); then
function upgrade() { function upgrade() {
yaourt -Syu yaourt -Syu
} }
elif (( $+commands[yay] )); then
function upgrade() {
yay -Syu
}
else else
function upgrade() { function upgrade() {
sudo pacman -Syu sudo pacman -Syu
} }
fi fi
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu' alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S' alias pacin='sudo pacman -S'
alias pacins='sudo pacman -U' alias pacins='sudo pacman -U'

View file

@ -5,4 +5,4 @@ for cmd in $cmds; do
done done
alias sc-enablenow="sc-enable --now" alias sc-enablenow="sc-enable --now"
alias sc-disablenow="sc-disable --now" alias sc-disablenow="sc-disable --now"

View file

@ -1,4 +1,4 @@
[[ $- == *i* && -f "/usr/share/fzf/completion.zsh" ]] && source "/usr/share/fzf/completion.zsh" 2> /dev/null [[ $- == *i* && -f "/usr/share/fzf/completion.zsh" ]] && source "/usr/share/fzf/completion.zsh" 2> /dev/null
[[ -f "/usr/share/fzf/key-bindings.zsh" ]] && source "/usr/share/fzf/key-bindings.zsh" [[ -f "/usr/share/fzf/key-bindings.zsh" ]] && source "/usr/share/fzf/key-bindings.zsh"
[[ $- == *i* && -f "/home/linuxbrew/.linuxbrew/opt/fzf/shell/completion.zsh" ]] && source "/home/linuxbrew/.linuxbrew/opt/fzf/shell/completion.zsh" 2> /dev/null [[ $- == *i* && -f "/home/linuxbrew/.linuxbrew/opt/fzf/shell/completion.zsh" ]] && source "/home/linuxbrew/.linuxbrew/opt/fzf/shell/completion.zsh" 2> /dev/null
[[ -f "/home/linuxbrew/.linuxbrew/opt/fzf/shell/key-bindings.zsh" ]] && source "/home/linuxbrew/.linuxbrew/opt/fzf/shell/key-bindings.zsh" [[ -f "/home/linuxbrew/.linuxbrew/opt/fzf/shell/key-bindings.zsh" ]] && source "/home/linuxbrew/.linuxbrew/opt/fzf/shell/key-bindings.zsh"

View file

@ -1,3 +1,3 @@
# Fix MobaXterm Home/End key with ZSH # Fix MobaXterm Home/End key with ZSH
bindkey '^[[H' beginning-of-line bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line bindkey '^[[F' end-of-line

View file

@ -7,4 +7,4 @@ for file in ${dotcfg}/zsh/cfg.d/source.d/*.zsh; do
source $file source $file
done done
source /usr/share/lmod/lmod/init/zsh source /usr/share/lmod/lmod/init/zsh

View file

@ -4,4 +4,4 @@ for file in ${HOME}/dotfiles/cfg/zsh/cfg.d/*.zsh; do
done done
# Prompt # Prompt
prompt z4rr3t prompt z4rr3t