[zsh] Convert all shell-log calls to ShellLog

This commit is contained in:
Eryn Wells 2022-01-22 09:11:53 -08:00
parent 0894a4957e
commit a13ecc9e4d
17 changed files with 28 additions and 28 deletions

View file

@ -1,11 +1,11 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me> # Eryn Wells <eryn@erynwells.me>
shell-log 'Initializing Login Environment' ShellLog 'Initializing Login Environment'
# Start SSH agent for password-less logins # Start SSH agent for password-less logins
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
print_info -l 1 'Starting ssh-agent' ShellLog 'Starting ssh-agent'
eval `ssh-agent -s` eval `ssh-agent -s`
trap "kill $SSH_AGENT_PID" 0 trap "kill $SSH_AGENT_PID" 0
fi fi

View file

@ -7,14 +7,14 @@ function darwin_configure_screenshots_directory
{ {
icloud=`darwin_icloud_drive_path` icloud=`darwin_icloud_drive_path`
if [[ ! -d "$icloud" ]]; then if [[ ! -d "$icloud" ]]; then
shell-log -l error "iCloud directory doesn't exist: $icloud" ShellLog -l error "iCloud directory doesn't exist: $icloud"
return 1 return 1
fi fi
# Put screenshots in iCloud Drive, in a directory according to hostname # Put screenshots in iCloud Drive, in a directory according to hostname
local name=`hostname -s | tr A-Z a-z` local name=`hostname -s | tr A-Z a-z`
local screenshots_dir="$icloud/Screenshots/$name" local screenshots_dir="$icloud/Screenshots/$name"
shell-log "Setting screenshot directory: $screenshots_dir" ShellLog "Setting screenshot directory: $screenshots_dir"
mkdir -p "$screenshots_dir" mkdir -p "$screenshots_dir"
defaults write com.apple.screencapture screenshots_diration "$screenshots_dir" defaults write com.apple.screencapture screenshots_diration "$screenshots_dir"

View file

@ -7,14 +7,14 @@ autoload darwin_configure_screenshots_directory
function darwin_init_once function darwin_init_once
{ {
# Dim dock icons of apps that have been hidden. # Dim dock icons of apps that have been hidden.
shell-log "Auto-hiding Dock" ShellLog "Auto-hiding Dock"
defaults write com.apple.Dock showhidden -boolean yes defaults write com.apple.Dock showhidden -boolean yes
killall Dock killall Dock
darwin_configure_screenshots_directory darwin_configure_screenshots_directory
# See https://techstuffer.com/this-app-is-damaged-error-macos-sierra/ # See https://techstuffer.com/this-app-is-damaged-error-macos-sierra/
shell-log "Disabling overly restrictive Gatekeeper" ShellLog "Disabling overly restrictive Gatekeeper"
sudo spctl --master-disable sudo spctl --master-disable
} }

View file

@ -4,7 +4,7 @@
function init_env function init_env
{ {
shell-log 'Initializing basic environment' ShellLog 'Initializing basic environment'
export PAGER="less" export PAGER="less"
export MANPAGER=$PAGER export MANPAGER=$PAGER

View file

@ -7,7 +7,7 @@ autoload prepend_to_path
function init_env_darwin function init_env_darwin
{ {
shell-log "Initializing Darwin environment" ShellLog "Initializing Darwin environment"
export OSBUILD=`sysctl -n kern.osversion` export OSBUILD=`sysctl -n kern.osversion`
export OSVERSION=`sysctl -n kern.osproductversion` export OSVERSION=`sysctl -n kern.osproductversion`

View file

@ -5,7 +5,7 @@ autoload binary_exists
function init_rc_aliases function init_rc_aliases
{ {
shell-log -l 'debug' "Setting up shell aliases" ShellLog -l 'debug' "Setting up shell aliases"
alias j='jobs' alias j='jobs'
alias h='history' alias h='history'
@ -28,7 +28,7 @@ function init_rc_aliases
binary_exists ledger && alias l='ledger' binary_exists ledger && alias l='ledger'
binary_exists gpg2 && alias gpg='gpg2' binary_exists gpg2 && alias gpg='gpg2'
shell-log -l debug 'Setting up suffix aliases' ShellLog -l debug 'Setting up suffix aliases'
alias -s c='vim' alias -s c='vim'
alias -s tex='vim' alias -s tex='vim'
alias -s txt='vim' alias -s txt='vim'

View file

@ -3,7 +3,7 @@
function init_rc_configure_completion function init_rc_configure_completion
{ {
shell-log 'Initializing completion system' ShellLog 'Initializing completion system'
autoload -U compinit autoload -U compinit
compinit compinit

View file

@ -7,7 +7,7 @@ function init_configure_ls
local ls_options local ls_options
if [[ ! -e "$1" ]]; then if [[ ! -e "$1" ]]; then
shell-log -l error 'Missing required path to ls binary' ShellLog -l error 'Missing required path to ls binary'
return return
fi fi
@ -19,7 +19,7 @@ function init_configure_ls
ls_options='-G' ls_options='-G'
fi fi
shell-log -l debug "Setting up aliases for $1" ShellLog -l debug "Setting up aliases for $1"
alias ls="$1 $ls_options" alias ls="$1 $ls_options"
alias la="$1 -A $ls_options" alias la="$1 -A $ls_options"
alias ll="$1 -l $ls_options" alias ll="$1 -l $ls_options"
@ -33,7 +33,7 @@ function init_configure_ls
dircolors="$HOME/.dircolors/default.cfg" dircolors="$HOME/.dircolors/default.cfg"
fi fi
shell-log -l debug "Setting up dircolors: `basename $dircolors`" ShellLog -l debug "Setting up dircolors: `basename $dircolors`"
eval `$dircolors_bin $dircolors` eval `$dircolors_bin $dircolors`
fi fi
} }

View file

@ -8,7 +8,7 @@ function init_rc_configure_prompt
theme=loquacious theme=loquacious
fi fi
shell-log -l debug 'Configuring vcs_info' ShellLog -l debug 'Configuring vcs_info'
autoload -U add-zsh-hook autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
@ -28,7 +28,7 @@ function init_rc_configure_prompt
add-zsh-hook precmd export_gitbranch add-zsh-hook precmd export_gitbranch
shell-log "Configuring prompt with '$theme' theme" ShellLog "Configuring prompt with '$theme' theme"
autoload -U promptinit autoload -U promptinit
promptinit promptinit
prompt $theme prompt $theme

View file

@ -3,7 +3,7 @@
function init_rc_configure_zle function init_rc_configure_zle
{ {
shell-log 'Configuring ZLE' ShellLog 'Configuring ZLE'
local mode=$1 local mode=$1
if [[ -z "$mode" ]]; then if [[ -z "$mode" ]]; then
@ -13,7 +13,7 @@ function init_rc_configure_zle
function configure_zle_emacs { } function configure_zle_emacs { }
function configure_zle_vim { } function configure_zle_vim { }
shell-log -l debug "Using $mode command line editing mode" ShellLog -l debug "Using $mode command line editing mode"
if [[ $mode == 'vim' ]]; then if [[ $mode == 'vim' ]]; then
bindkey -v bindkey -v
configure_zle_vim configure_zle_vim

View file

@ -5,7 +5,7 @@ autoload binary_exists
function init_rc_darwin function init_rc_darwin
{ {
shell-log 'Initializing Interactive Environment for macOS' ShellLog 'Initializing Interactive Environment for macOS'
alias acls='command ls -le' alias acls='command ls -le'

View file

@ -3,7 +3,7 @@
function init_rc_linux function init_rc_linux
{ {
shell-log 'Initializing Interactive Environment for Linux' ShellLog 'Initializing Interactive Environment for Linux'
alias iptls='sudo iptables --line-numbers -nv -L' alias iptls='sudo iptables --line-numbers -nv -L'
alias ip6tls='sudo ip6tables --line-numbers -nv -L' alias ip6tls='sudo ip6tables --line-numbers -nv -L'

View file

@ -7,7 +7,7 @@ function init_zsh_functions
{ {
local myfpath="$HOME/.zsh/func" local myfpath="$HOME/.zsh/func"
shell-log "Loading functions in $myfpath" ShellLog "Loading functions in $myfpath"
for func in $myfpath/*; do for func in $myfpath/*; do
[[ ! -e "$func" || -d "$func" ]] && continue [[ ! -e "$func" || -d "$func" ]] && continue
@ -15,7 +15,7 @@ function init_zsh_functions
[[ "$functionName" =~ "prompt_*" ]] && continue [[ "$functionName" =~ "prompt_*" ]] && continue
[[ "$functionName" =~ "init_*" ]] && continue [[ "$functionName" =~ "init_*" ]] && continue
shell-log -l debug "Loading $functionName" ShellLog -l debug "Loading $functionName"
autoload +X $functionName autoload +X $functionName
done done

View file

@ -3,7 +3,7 @@
function init_zsh_history function init_zsh_history
{ {
shell-log 'Setting up history' ShellLog 'Setting up history'
setopt \ setopt \
APPEND_HISTORY \ APPEND_HISTORY \

View file

@ -3,7 +3,7 @@
function init_zsh_options function init_zsh_options
{ {
shell-log 'Setting shell options' ShellLog 'Setting shell options'
# Report seconds since shell was invoked in milliseconds # Report seconds since shell was invoked in milliseconds
typeset -F SECONDS typeset -F SECONDS

View file

@ -13,15 +13,15 @@ function load_module
done done
if [[ -z "$modpath" ]]; then if [[ -z "$modpath" ]]; then
shell-log -l error "Couldn't find path to module: $mod" ShellLog -l error "Couldn't find path to module: $mod"
return 1 return 1
fi fi
fpath+=($modpath) fpath+=($modpath)
shell-log "Loading module: $mod" ShellLog "Loading module: $mod"
for func in `ls $modpath`; do for func in `ls $modpath`; do
shell-log "Loading function: $func" ShellLog "Loading function: $func"
autoload $func autoload $func
done done

2
zshrc
View file

@ -1,7 +1,7 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me> # Eryn Wells <eryn@erynwells.me>
shell-log 'Initializing Interactive Environment' ShellLog 'Initializing Interactive Environment'
autoload +X init_app_environments autoload +X init_app_environments
autoload +X init_rc_aliases autoload +X init_rc_aliases