Skip to content

Commit

Permalink
fix: Use -p instead of --parents for mkdir (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpriscella authored Feb 13, 2024
1 parent d58b26b commit cb3bad6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
pull_request:
paths:
- '**.sh'
- "**.sh"

name: ShellCheck

Expand All @@ -13,3 +13,5 @@ jobs:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/[email protected]
with:
ignore_names: .zshrc
47 changes: 20 additions & 27 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
######## zinit (https://github.com/zdharma-continuum/zinit) integration ########

ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
[ ! -d "$ZINIT_HOME" ] && mkdir -p "$(dirname "$ZINIT_HOME")"
[ ! -d "$ZINIT_HOME"/.git ] && git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"

##################################### brew #####################################

if [ -d "/opt/homebrew/bin" ]; then
export PATH="/opt/homebrew/bin:$PATH"

if (( $+commands[brew] ))
then
if type "brew" >/dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
Expand Down Expand Up @@ -47,7 +46,7 @@ alias grep='grep --color=auto '

# Need to see if this works or if we need to use ls --color=auto
# TODO should work on both darwin(mac) and linux.
if ls -G > /dev/null 2>&1 ; then
if ls -G >/dev/null 2>&1; then
alias ls='ls -G'
else
alias ls='ls --color=always'
Expand All @@ -57,10 +56,9 @@ export PATH=$HOME/.bin:$HOME/.nvim/bin:$PATH

##################################### aws ######################################

if (( $+commands[aws] && $+commands[aws_completer] ))
then
if (type "aws" >/dev/null && type aws_completer >/dev/null); then
aws_completer_path=$(which aws_completer)
complete -C $aws_completer_path aws
complete -C "$aws_completer_path" aws

export AWS_CLI_AUTO_PROMPT=on-partial

Expand All @@ -75,7 +73,7 @@ then
#######################################
function aws-ps {
profile=$(aws configure list-profiles | fzf --height=30% --layout=reverse --border --margin=1 --padding=1)
if [ ! -z "$profile" ]; then
if [ -n "$profile" ]; then
export AWS_PROFILE=$profile
fi
}
Expand All @@ -86,7 +84,7 @@ then
# None
#######################################
function ecr-login {
if [[ $(aws sts get-caller-identity > /dev/null 2>&1) -ne 0 ]]; then
if [[ $(aws sts get-caller-identity >/dev/null 2>&1) -ne 0 ]]; then
echo "Could not connect to AWS account. Please verify that your credentials are correct."
kill -INT $$
fi
Expand All @@ -102,8 +100,7 @@ fi

#################################### Editor ####################################

if (( $+commands[nvim] ))
then
if type "nvim" >/dev/null; then
export GIT_EDITOR=nvim
export KUBE_EDITOR=nvim

Expand All @@ -118,25 +115,22 @@ fi

############## FZF (https://github.com/junegunn/fzf) integration ###############

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f "$HOME"/.fzf.zsh ] && source "$HOME"/.fzf.zsh
bindkey -s '^P' 'fzf^M'
export FZF_DEFAULT_COMMAND='find . -not -path "**/.git/**"'

################################## Kubernetes ##################################

if (( $+commands[helm] ))
then
if type "helm" >/dev/null; then
source <(helm completion zsh)
fi

if (( $+commands[kind] ))
then
if type "kind" >/dev/null; then
source <(kind completion zsh)
fi

export RPROMPT=""
if (( $+commands[kubectl] ))
then
if type "kubectl" >/dev/null; then
source <(kubectl completion zsh)
zinit load jonmosco/kube-ps1

Expand All @@ -146,28 +140,27 @@ fi

#################################### GitHub ####################################

if (( $+commands[gh] ))
then
if type "gh" >/dev/null; then
source <(gh completion --shell zsh)
fi

################################### Functions ##################################

if (( $+commands[helm] && $+commands[kubectl] )) {
[ -f ~/.kshell.sh ] && source ~/.kshell.sh
}
if (type "helm" >/dev/null && type "kubectl" >/dev/null); then
[ -f "$HOME"/.kshell.sh ] && source "$HOME"/.kshell.sh
fi

############################### Load Local zshrc ###############################

[ -f ~/.zshrc.local ] && source ~/.zshrc.local
# shellcheck source=/dev/null
[ -f "$HOME"/.zshrc.local ] && source "$HOME"/.zshrc.local

gen_prompt=''
if [ -n "$AWS_PROFILE" ]; then
gen_prompt='%{$fg[green]%}${AWS_PROFILE}%{$reset_color%}'
fi

if (( $+commands[kubectl] ))
then
if type "kubectl" >/dev/null; then
gen_prompt="$gen_prompt%::$(kube_ps1)"
fi

Expand Down
4 changes: 2 additions & 2 deletions dotfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ function install_dotfiles() {
brew install --casks \
dbeaver-community \
font-space-mono-nerd-font
brew install derailed/k9s/k9s dive gh helm jq shellcheck sslscan step tmux yq yt-dlp
brew install derailed/k9s/k9s dive gh helm jq kind neovim shellcheck sslscan step tmux yq yt-dlp
;;
*)
echo "Operating System '$OS' not supported."
;;
esac

for i in $files; do
mkdir --parents "$(dirname "$HOME"/"$i")"
mkdir -p "$(dirname "$HOME"/"$i")"
if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then
rm "$HOME"/"$i"
elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then
Expand Down

0 comments on commit cb3bad6

Please sign in to comment.