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
|
||||
fi
|
||||
|
||||
if [[ (($result -eq 0) || ($result -eq 1)) ]]; then
|
||||
if [ $result -eq 0 ] || [ $result -eq 1 ]; then
|
||||
if [[ -n "$_LIVE_AGENT_LIST" ]]; then
|
||||
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
|
||||
else
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
# Clone zgen if you haven't already
|
||||
check_zgen_installation() {
|
||||
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"
|
||||
fi
|
||||
if [[ ! -f $ZGEN_DIR/zgen.zsh ]]; then
|
||||
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
|
||||
mkdir -p "$ZGEN_PARENT_DIR"
|
||||
fi
|
||||
cd $ZGEN_PARENT_DIR || return
|
||||
git clone https://github.com/tarjoilija/zgen.git $ZGEN_DIR
|
||||
cd "$ZGEN_PARENT_DIR" || return
|
||||
git clone https://github.com/tarjoilija/zgen.git "$ZGEN_DIR"
|
||||
fi
|
||||
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
|
||||
# shellcheck disable=SC1091
|
||||
source $ZGEN_DIR/zgen.zsh
|
||||
source "$ZGEN_DIR"/zgen.zsh
|
||||
unset ZGEN_PARENT_DIR
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/zsh
|
||||
# mkdir & cd
|
||||
function mkcd {
|
||||
function mkcd() {
|
||||
mkdir -p "$@" && cd "$_" || return
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# show newest files
|
||||
# http://www.commandlinefu.com/commands/view/9015/find-the-most-recently-changed-files-recursively
|
||||
newest() {
|
||||
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | \
|
||||
grep -v cache | \
|
||||
grep -v '.hg' | grep -v '.git' | \
|
||||
sort -r | \
|
||||
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' |
|
||||
grep -v cache |
|
||||
grep -v '.hg' | grep -v '.git' |
|
||||
sort -r |
|
||||
less
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#!/bin/zsh
|
||||
#
|
||||
# Speed up autocomplete, force prefix mapping
|
||||
zstyle ':completion:*' accept-exact '*(N)'
|
||||
zstyle ':completion:*' use-cache on
|
||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||
# 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
|
||||
if [ -d ~/.zsh-completions ]; then
|
||||
for completion in ~/.zsh-completions/*
|
||||
do
|
||||
for completion in ~/.zsh-completions/*; do
|
||||
# shellcheck source=/dev/null
|
||||
source "$completion"
|
||||
done
|
||||
|
|
|
@ -5,20 +5,18 @@
|
|||
|
||||
# In case a plugin adds a redundant path entry, remove duplicate entries
|
||||
# from PATH
|
||||
#
|
||||
# This snippet is from Mislav Marohnić <mislav.marohnic@gmail.com>'s
|
||||
# dotfiles repo at https://github.com/mislav/dotfiles
|
||||
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}
|
||||
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
|
||||
get_var() {
|
||||
eval 'printf "%s\n" "${'"$1"'}"'
|
||||
}
|
||||
|
||||
dedupe_path
|
||||
set_var() {
|
||||
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