Fix static analysis and lint errors
This commit is contained in:
parent
8494eda973
commit
d7e8831423
9 changed files with 116 additions and 117 deletions
|
@ -74,7 +74,7 @@ test_agent_socket() {
|
||||||
_KEY_COUNT=0
|
_KEY_COUNT=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ (($result -eq 0) || ($result -eq 1)) ]]; then
|
if [ $result -eq 0 ] || [ $result -eq 1 ]; then
|
||||||
if [[ -n "$_LIVE_AGENT_LIST" ]]; then
|
if [[ -n "$_LIVE_AGENT_LIST" ]]; then
|
||||||
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
|
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
# Clone zgen if you haven't already
|
# Clone zgen if you haven't already
|
||||||
check_zgen_installation() {
|
check_zgen_installation() {
|
||||||
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
|
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
|
||||||
ZGEN_PARENT_DIR=${${XDG_CONFIG_HOME}:="$HOME/.config/"}
|
ZGEN_PARENT_DIR=${XDG_CONFIG_HOME:="$HOME/.config/"}
|
||||||
ZGEN_DIR="$ZGEN_PARENT_DIR/zgen"
|
ZGEN_DIR="$ZGEN_PARENT_DIR/zgen"
|
||||||
fi
|
fi
|
||||||
if [[ ! -f $ZGEN_DIR/zgen.zsh ]]; then
|
if [[ ! -f $ZGEN_DIR/zgen.zsh ]]; then
|
||||||
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
|
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
|
||||||
mkdir -p "$ZGEN_PARENT_DIR"
|
mkdir -p "$ZGEN_PARENT_DIR"
|
||||||
fi
|
fi
|
||||||
cd $ZGEN_PARENT_DIR || return
|
cd "$ZGEN_PARENT_DIR" || return
|
||||||
git clone https://github.com/tarjoilija/zgen.git $ZGEN_DIR
|
git clone https://github.com/tarjoilija/zgen.git "$ZGEN_DIR"
|
||||||
fi
|
fi
|
||||||
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
|
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source $ZGEN_DIR/zgen.zsh
|
source "$ZGEN_DIR"/zgen.zsh
|
||||||
unset ZGEN_PARENT_DIR
|
unset ZGEN_PARENT_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
# mkdir & cd
|
# mkdir & cd
|
||||||
function mkcd {
|
function mkcd() {
|
||||||
mkdir -p "$@" && cd "$_" || return
|
mkdir -p "$@" && cd "$_" || return
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# show newest files
|
# show newest files
|
||||||
# http://www.commandlinefu.com/commands/view/9015/find-the-most-recently-changed-files-recursively
|
# http://www.commandlinefu.com/commands/view/9015/find-the-most-recently-changed-files-recursively
|
||||||
newest() {
|
newest() {
|
||||||
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | \
|
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' |
|
||||||
grep -v cache | \
|
grep -v cache |
|
||||||
grep -v '.hg' | grep -v '.git' | \
|
grep -v '.hg' | grep -v '.git' |
|
||||||
sort -r | \
|
sort -r |
|
||||||
less
|
less
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
#
|
||||||
# Speed up autocomplete, force prefix mapping
|
# Speed up autocomplete, force prefix mapping
|
||||||
zstyle ':completion:*' accept-exact '*(N)'
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")';
|
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
|
||||||
|
|
||||||
# Load any custom zsh completions we've installed
|
# Load any custom zsh completions we've installed
|
||||||
if [ -d ~/.zsh-completions ]; then
|
if [ -d ~/.zsh-completions ]; then
|
||||||
for completion in ~/.zsh-completions/*
|
for completion in ~/.zsh-completions/*; do
|
||||||
do
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "$completion"
|
source "$completion"
|
||||||
done
|
done
|
||||||
|
|
|
@ -5,20 +5,18 @@
|
||||||
|
|
||||||
# In case a plugin adds a redundant path entry, remove duplicate entries
|
# In case a plugin adds a redundant path entry, remove duplicate entries
|
||||||
# from PATH
|
# from PATH
|
||||||
#
|
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||||
# This snippet is from Mislav Marohnić <mislav.marohnic@gmail.com>'s
|
get_var() {
|
||||||
# dotfiles repo at https://github.com/mislav/dotfiles
|
eval 'printf "%s\n" "${'"$1"'}"'
|
||||||
dedupe_path() {
|
|
||||||
typeset -a paths result
|
|
||||||
paths=($path)
|
|
||||||
|
|
||||||
while [[ ${#paths} -gt 0 ]]; do
|
|
||||||
p="${paths[1]}"
|
|
||||||
shift paths
|
|
||||||
[[ -z ${paths[(r)$p]} ]] && result+="$p"
|
|
||||||
done
|
|
||||||
|
|
||||||
export PATH=${(j+:+)result}
|
|
||||||
}
|
}
|
||||||
|
set_var() {
|
||||||
dedupe_path
|
eval "$1=\"\$2\""
|
||||||
|
}
|
||||||
|
dedup_pathvar() {
|
||||||
|
pathvar_name="$1"
|
||||||
|
pathvar_value="$(get_var "$pathvar_name")"
|
||||||
|
deduped_path="$(perl -e 'print join(":",grep { not $seen{$_}++ } split(/:/, $ARGV[0]))' "$pathvar_value")"
|
||||||
|
set_var "$pathvar_name" "$deduped_path"
|
||||||
|
}
|
||||||
|
dedup_pathvar PATH
|
||||||
|
dedup_pathvar MANPATH
|
||||||
|
|
Loading…
Reference in a new issue