[zsh] Convert all shell-log calls to ShellLog
This commit is contained in:
		
							parent
							
								
									0894a4957e
								
							
						
					
					
						commit
						a13ecc9e4d
					
				
					 17 changed files with 28 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -7,14 +7,14 @@ function darwin_configure_screenshots_directory
 | 
			
		|||
{
 | 
			
		||||
    icloud=`darwin_icloud_drive_path`
 | 
			
		||||
    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
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Put screenshots in iCloud Drive, in a directory according to hostname
 | 
			
		||||
    local name=`hostname -s | tr A-Z a-z`
 | 
			
		||||
    local screenshots_dir="$icloud/Screenshots/$name"
 | 
			
		||||
    shell-log "Setting screenshot directory: $screenshots_dir"
 | 
			
		||||
    ShellLog "Setting screenshot directory: $screenshots_dir"
 | 
			
		||||
    mkdir -p "$screenshots_dir"
 | 
			
		||||
    defaults write com.apple.screencapture screenshots_diration "$screenshots_dir"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,14 +7,14 @@ autoload darwin_configure_screenshots_directory
 | 
			
		|||
function darwin_init_once
 | 
			
		||||
{
 | 
			
		||||
    # 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
 | 
			
		||||
    killall Dock
 | 
			
		||||
 | 
			
		||||
    darwin_configure_screenshots_directory
 | 
			
		||||
 | 
			
		||||
    # 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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
 | 
			
		||||
function init_env
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Initializing basic environment'
 | 
			
		||||
    ShellLog 'Initializing basic environment'
 | 
			
		||||
 | 
			
		||||
    export PAGER="less"
 | 
			
		||||
    export MANPAGER=$PAGER
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ autoload prepend_to_path
 | 
			
		|||
 | 
			
		||||
function init_env_darwin
 | 
			
		||||
{
 | 
			
		||||
    shell-log "Initializing Darwin environment"
 | 
			
		||||
    ShellLog "Initializing Darwin environment"
 | 
			
		||||
 | 
			
		||||
    export OSBUILD=`sysctl -n kern.osversion`
 | 
			
		||||
    export OSVERSION=`sysctl -n kern.osproductversion`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ autoload binary_exists
 | 
			
		|||
 | 
			
		||||
function init_rc_aliases
 | 
			
		||||
{
 | 
			
		||||
    shell-log -l 'debug' "Setting up shell aliases"
 | 
			
		||||
    ShellLog -l 'debug' "Setting up shell aliases"
 | 
			
		||||
 | 
			
		||||
    alias j='jobs'
 | 
			
		||||
    alias h='history'
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ function init_rc_aliases
 | 
			
		|||
    binary_exists ledger && alias l='ledger'
 | 
			
		||||
    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 tex='vim'
 | 
			
		||||
    alias -s txt='vim'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
function init_rc_configure_completion
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Initializing completion system'
 | 
			
		||||
    ShellLog 'Initializing completion system'
 | 
			
		||||
 | 
			
		||||
    autoload -U compinit
 | 
			
		||||
    compinit
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ function init_configure_ls
 | 
			
		|||
    local ls_options
 | 
			
		||||
 | 
			
		||||
    if [[ ! -e "$1" ]]; then
 | 
			
		||||
        shell-log -l error 'Missing required path to ls binary'
 | 
			
		||||
        ShellLog -l error 'Missing required path to ls binary'
 | 
			
		||||
        return
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ function init_configure_ls
 | 
			
		|||
        ls_options='-G'
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    shell-log -l debug "Setting up aliases for $1"
 | 
			
		||||
    ShellLog -l debug "Setting up aliases for $1"
 | 
			
		||||
    alias ls="$1 $ls_options"
 | 
			
		||||
    alias la="$1 -A $ls_options"
 | 
			
		||||
    alias ll="$1 -l $ls_options"
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ function init_configure_ls
 | 
			
		|||
            dircolors="$HOME/.dircolors/default.cfg"
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        shell-log -l debug "Setting up dircolors: `basename $dircolors`"
 | 
			
		||||
        ShellLog -l debug "Setting up dircolors: `basename $dircolors`"
 | 
			
		||||
        eval `$dircolors_bin $dircolors`
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ function init_rc_configure_prompt
 | 
			
		|||
        theme=loquacious
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    shell-log -l debug 'Configuring vcs_info'
 | 
			
		||||
    ShellLog -l debug 'Configuring vcs_info'
 | 
			
		||||
 | 
			
		||||
    autoload -U add-zsh-hook
 | 
			
		||||
    autoload -Uz vcs_info
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ function init_rc_configure_prompt
 | 
			
		|||
 | 
			
		||||
    add-zsh-hook precmd export_gitbranch
 | 
			
		||||
 | 
			
		||||
    shell-log "Configuring prompt with '$theme' theme"
 | 
			
		||||
    ShellLog "Configuring prompt with '$theme' theme"
 | 
			
		||||
    autoload -U promptinit
 | 
			
		||||
    promptinit
 | 
			
		||||
    prompt $theme
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
function init_rc_configure_zle
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Configuring ZLE'
 | 
			
		||||
    ShellLog 'Configuring ZLE'
 | 
			
		||||
 | 
			
		||||
    local mode=$1
 | 
			
		||||
    if [[ -z "$mode" ]]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ function init_rc_configure_zle
 | 
			
		|||
    function configure_zle_emacs { }
 | 
			
		||||
    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
 | 
			
		||||
        bindkey -v
 | 
			
		||||
        configure_zle_vim
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ autoload binary_exists
 | 
			
		|||
 | 
			
		||||
function init_rc_darwin
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Initializing Interactive Environment for macOS'
 | 
			
		||||
    ShellLog 'Initializing Interactive Environment for macOS'
 | 
			
		||||
 | 
			
		||||
    alias acls='command ls -le'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
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 ip6tls='sudo ip6tables --line-numbers -nv -L'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ function init_zsh_functions
 | 
			
		|||
{
 | 
			
		||||
    local myfpath="$HOME/.zsh/func"
 | 
			
		||||
 | 
			
		||||
    shell-log "Loading functions in $myfpath"
 | 
			
		||||
    ShellLog "Loading functions in $myfpath"
 | 
			
		||||
    for func in $myfpath/*; do
 | 
			
		||||
        [[ ! -e "$func" || -d "$func" ]] && continue
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ function init_zsh_functions
 | 
			
		|||
        [[ "$functionName" =~ "prompt_*" ]] && continue
 | 
			
		||||
        [[ "$functionName" =~ "init_*" ]] && continue
 | 
			
		||||
 | 
			
		||||
        shell-log -l debug "Loading $functionName"
 | 
			
		||||
        ShellLog -l debug "Loading $functionName"
 | 
			
		||||
        autoload +X $functionName
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
function init_zsh_history
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Setting up history'
 | 
			
		||||
    ShellLog 'Setting up history'
 | 
			
		||||
 | 
			
		||||
    setopt \
 | 
			
		||||
        APPEND_HISTORY \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
 | 
			
		||||
function init_zsh_options
 | 
			
		||||
{
 | 
			
		||||
    shell-log 'Setting shell options'
 | 
			
		||||
    ShellLog 'Setting shell options'
 | 
			
		||||
 | 
			
		||||
    # Report seconds since shell was invoked in milliseconds
 | 
			
		||||
    typeset -F SECONDS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,15 +13,15 @@ function load_module
 | 
			
		|||
    done
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    fpath+=($modpath)
 | 
			
		||||
 | 
			
		||||
    shell-log "Loading module: $mod"
 | 
			
		||||
    ShellLog "Loading module: $mod"
 | 
			
		||||
    for func in `ls $modpath`; do
 | 
			
		||||
        shell-log "Loading function: $func"
 | 
			
		||||
        ShellLog "Loading function: $func"
 | 
			
		||||
        autoload $func
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue