diff --git a/home/.chezmoiexternal.toml.tmpl b/home/.chezmoiexternal.toml.tmpl index 3f426b7e..8598f66e 100644 --- a/home/.chezmoiexternal.toml.tmpl +++ b/home/.chezmoiexternal.toml.tmpl @@ -258,7 +258,7 @@ pull.args = ["--ff-only"] ### NGINX -[".local/system/etc/nginx"] +[".local/etc/nginx"] type = "git-repo" url = "https://gitlab.com/megabyte-labs/cloud/nginx-configs.git" clone.args = ["--depth", "1"] diff --git a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl index 32ef35de..71d4bdea 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl @@ -109,7 +109,7 @@ if [ -d /System ] && [ -d /Applications ] && command -v warp-cli > /dev/null; th logg info 'Requesting security authorization for Cloudflare trusted certificate' sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.crt" logg info 'Updating the OpenSSL CA Store to include the Cloudflare certificate' - echo | sudo tee -a /etc/ssl/cert.pem < "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" + echo | sudo tee -a /etc/ssl/cert.pem < "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" > /dev/null else logg warn 'Session is SSH so adding Cloudflare encryption key to trusted certificates via the security program is being bypassed since it requires Touch ID / Password verification.' fi @@ -137,7 +137,7 @@ elif command -v warp-cli > /dev/null; then logg info '`dpkg-reconfigure` executable detected so using Debian/Ubuntu method of updating system trusted certificates to include CloudFlare Teams certificate' sudo dpkg-reconfigure ca-certificates else - logg warn + logg warn fi elif command -v update-ca-trust > /dev/null; then if [ -d /etc/pki/ca-trust/source/anchors ]; then @@ -213,7 +213,7 @@ if command -v warp-cli > /dev/null; then sudo mkdir -p /var/lib/cloudflare-warp sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/warp/mdm.xml" /var/lib/cloudflare-warp/mdm.xml fi - + ### Register CloudFlare WARP if warp-cli --accept-tos status | grep 'Registration missing' > /dev/null; then logg info 'Registering CloudFlare WARP' diff --git a/home/dot_bashrc b/home/dot_bashrc index 7c3975a8..46a6ae98 100644 --- a/home/dot_bashrc +++ b/home/dot_bashrc @@ -1,19 +1,32 @@ #!/usr/bin/env bash # shellcheck disable=SC1090,SC1091 +### /etc/bashrc +[ ! -f /etc/bashrc ] || . /etc/bashrc + # Prefer US English export LANG="en_US" if [[ "$(hostname)" != *'-minimal' ]]; then export LC_ALL="en_US.UTF-8" fi -### Sensible Bash -# Source: https://github.com/mrzool/bash-sensible -[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/shell/sensible.bash" ] || . "${XDG_DATA_HOME:-$HOME/.local/share}/shell/sensible.bash" - # Detect support for advanced terminal features -if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then - export BASH_SUPPORT=true +if [ -t 1 ]; then + if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then + export BASH_SUPPORT=true + + ### Pre-exec + # Source: https://github.com/rcaloras/bash-preexec + if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bash/pre-exec.bash" ]; then + export __bp_enable_subshells="true" + . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bash/pre-exec.bash" + preexec() { echo "just typed $1"; } + precmd() { echo "printing the prompt"; } + fi + + ### Java (asdf) + [ ! -f "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" ] || . "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" + fi fi ### Import Common Settings @@ -23,50 +36,32 @@ fi # Loaded with bash-it # [[ $- == *i* ]] && source "${XDG_DATA_HOME:-$HOME/.local/share}/blesh/ble.sh" --noattach --rcfile "${XDG_DATA_CONFIG:-$HOME/.config}/blesh/bleshrc" -### /etc/bashrc -[ ! -f /etc/bashrc ] || . /etc/bashrc - -### Java (asdf) -[ ! -f "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" ] || . "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" - ### Escape if shell not interactive case $- in *i*) ;; *) return;; esac -### Fig / LC_ALL -if [ "$BASH_SUPPORT" = 'true' ]; then - if [ -f "$HOME/.fig/shell/bashrc.pre.bash" ]; then - . "$HOME/.fig/shell/bashrc.pre.bash" - fi -fi - -### Pre-exec -# Source: https://github.com/rcaloras/bash-preexec -if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bash/pre-exec.bash" ]; then - export __bp_enable_subshells="true" - . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bash/pre-exec.bash" - preexec() { echo "just typed $1"; } - precmd() { echo "printing the prompt"; } -fi - ### History export HISTFILE="$XDG_STATE_HOME/bash/history" -if [ -d "$HISTFILE" ]; then - # Remove history file if it is incorrectly created as a directory - rm -rf "$HISTFILE" -fi +[ ! -d "$HISTFILE" ] || rm -rf "$HISTFILE" ### Bash Initialization Hooks if [ "$BASH_SUPPORT" = 'true' ]; then + ### Sensible Bash + # Source: https://github.com/mrzool/bash-sensible + [ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/shell/sensible.bash" ] || source "${XDG_DATA_HOME:-$HOME/.local/share}/shell/sensible.bash" + + ### Fig / LC_ALL + [ ! -f "$HOME/.fig/shell/bashrc.pre.bash" ] || source "$HOME/.fig/shell/bashrc.pre.bash" + # Prompt (on bash only) if [[ "$(hostname)" != *'-minimal' ]]; then ### Styled Terminal export BASH_IT="${XDG_DATA_HOME:-$HOME/.local/share}/bash_it" export BASH_IT_THEME="powerline" if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then - . "$BASH_IT/bash_it.sh" + source "$BASH_IT/bash_it.sh" elif command -v oh-my-posh > /dev/null; then # Oh My Posh (See: https://ohmyposh.dev/) eval "$(oh-my-posh init bash --config "${XDG_CONFIG_HOME:-$HOME/.config}/oh-my-posh/Betelgeuse.omp.json")" @@ -87,7 +82,7 @@ if [ "$BASH_SUPPORT" = 'true' ]; then autoload -U +X bashcompinit && bashcompinit if command -v brew > /dev/null; then if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then - . "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" + source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" else for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do [[ -r "${COMPLETION}" ]] && source "${COMPLETION}" @@ -102,30 +97,30 @@ if [ "$BASH_SUPPORT" = 'true' ]; then ! command -v carapace > /dev/null || source <(carapace _carapace) ### Cod - ! command -v cod > /dev/null || . <(cod init $$ bash) + ! command -v cod > /dev/null || source <(cod init $$ bash) ### Google Cloud SDK - [ ! -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ] || . "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc" + [ ! -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ] || source "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc" ### direnv ! command -v direnv > /dev/null || eval "$(direnv hook bash)" ### Emplace - ! command -v emplace > /dev/null || . <(emplace init bash) + ! command -v emplace > /dev/null || source <(emplace init bash) ### hiSHtory if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" ]; then export PATH="$PATH:${XDG_CONFIG_HOME:-$HOME/.config}/hishtory" - . "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" + source "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" fi ### Hoard if command -v hoard > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/hoard/src/shell/hoard.bash" ]; then - . "${XDG_DATA_HOME:-$HOME/.local/share}/hoard/src/shell/hoard.bash" + source "${XDG_DATA_HOME:-$HOME/.local/share}/hoard/src/shell/hoard.bash" fi ### iTerm2 - [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash" + [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash" ### Fig [ ! -f "$HOME/.fig/shell/bashrc.post.bash" ] || . "$HOME/.fig/shell/bashrc.post.bash" @@ -173,14 +168,14 @@ if [ "$BASH_SUPPORT" = 'true' ]; then ### SDKMan if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec" - . "$SDKMAN_DIR/bin/sdkman-init.sh" + source "$SDKMAN_DIR/bin/sdkman-init.sh" elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman" - . "$SDKMAN_DIR/bin/sdkman-init.sh" + source "$SDKMAN_DIR/bin/sdkman-init.sh" fi ### Up - [ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" ] || . "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" + [ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" ] || source "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" ### Vault ! command -v vault > /dev/null || complete -C vault vault diff --git a/home/dot_config/shell/iterm/iterm2.bash.tmpl b/home/dot_config/shell/iterm/iterm2.bash.tmpl index 9193b114..57298346 100644 --- a/home/dot_config/shell/iterm/iterm2.bash.tmpl +++ b/home/dot_config/shell/iterm/iterm2.bash.tmpl @@ -1,5 +1,5 @@ {{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash") -}} {{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash" -}} -{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash") -}} +{{- else if stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash") -}} {{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash" -}} {{- end -}} \ No newline at end of file diff --git a/home/dot_config/shell/iterm/iterm2.fish.tmpl b/home/dot_config/shell/iterm/iterm2.fish.tmpl index 984f7876..e8d38199 100644 --- a/home/dot_config/shell/iterm/iterm2.fish.tmpl +++ b/home/dot_config/shell/iterm/iterm2.fish.tmpl @@ -1,5 +1,5 @@ {{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish") -}} {{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish" -}} -{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish") -}} +{{- else if stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish") -}} {{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish" -}} {{- end -}} \ No newline at end of file diff --git a/home/dot_config/shell/iterm/iterm2.tcsh.tmpl b/home/dot_config/shell/iterm/iterm2.tcsh.tmpl index e4abd764..b48c79b3 100644 --- a/home/dot_config/shell/iterm/iterm2.tcsh.tmpl +++ b/home/dot_config/shell/iterm/iterm2.tcsh.tmpl @@ -1,5 +1,5 @@ {{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh") -}} {{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh" -}} -{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh") -}} +{{- else if stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh") -}} {{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh" -}} {{- end -}} \ No newline at end of file diff --git a/home/dot_config/shell/iterm/iterm2.zsh.tmpl b/home/dot_config/shell/iterm/iterm2.zsh.tmpl index 79de5c8e..be5fd617 100644 --- a/home/dot_config/shell/iterm/iterm2.zsh.tmpl +++ b/home/dot_config/shell/iterm/iterm2.zsh.tmpl @@ -1,5 +1,5 @@ {{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh") -}} {{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh" -}} -{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh") -}} +{{- else if stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh") -}} {{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh" -}} {{- end -}} \ No newline at end of file diff --git a/home/dot_local/share/bash-completion/completions/bashly.bash b/home/dot_local/share/bash-completion/completions/bashly.bash new file mode 100644 index 00000000..58635913 --- /dev/null +++ b/home/dot_local/share/bash-completion/completions/bashly.bash @@ -0,0 +1,115 @@ +# bashly completion -*- shell-script -*- + +# This bash completions script was generated by +# completely (https://github.com/dannyben/completely) +# Modifying it manually is not recommended + +_bashly_completions_filter() { + local words="$1" + local cur=${COMP_WORDS[COMP_CWORD]} + local result=() + + if [[ "${cur:0:1}" == "-" ]]; then + echo "$words" + + else + for word in $words; do + [[ "${word:0:1}" != "-" ]] && result+=("$word") + done + + echo "${result[*]}" + + fi +} + +_bashly_completions() { + local cur=${COMP_WORDS[COMP_CWORD]} + local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}") + local compline="${compwords[*]}" + + case "$compline" in + 'generate'*'--env') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" ) + ;; + + 'generate'*'-e') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" ) + ;; + + 'completions'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --install -i")" -- "$cur" ) + ;; + + 'validate'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --verbose -v")" -- "$cur" ) + ;; + + 'generate'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --env --force --quiet --upgrade --watch --wrap -e -f -q -r -u -w")" -- "$cur" ) + ;; + + 'preview'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" ) + ;; + + 'g'*'--env') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" ) + ;; + + 'shell'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" ) + ;; + + 'init'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --minimal -m")" -- "$cur" ) + ;; + + 'g'*'-e') + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" ) + ;; + + 'add'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --force --list --source -f -l -s colors completions completions_script completions_yaml config help hooks lib settings strings test validations yaml")" -- "$cur" ) + ;; + + 'doc'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --index -i arg arg.allowed arg.default arg.help arg.name arg.repeatable arg.required arg.validate command command.alias command.args command.catch_all command.commands command.completions command.default command.dependencies command.environment_variables command.examples command.expose command.extensible command.filename command.filters command.flags command.footer command.function command.group command.help command.name command.private command.version environment_variable environment_variable.default environment_variable.help environment_variable.name environment_variable.private environment_variable.required flag flag.allowed flag.arg flag.completions flag.conflicts flag.default flag.help flag.long flag.private flag.repeatable flag.required flag.short flag.validate")" -- "$cur" ) + ;; + + 'i'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --minimal -m")" -- "$cur" ) + ;; + + 'p'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" ) + ;; + + 'v'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --verbose -v")" -- "$cur" ) + ;; + + 'g'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --env --force --quiet --upgrade --watch --wrap -e -f -q -r -u -w")" -- "$cur" ) + ;; + + 'a'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --force --list --source -f -l -s colors completions completions_script completions_yaml config help hooks lib settings strings test validations yaml")" -- "$cur" ) + ;; + + 'c'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --install -i")" -- "$cur" ) + ;; + + 's'*) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" ) + ;; + + *) + while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --version -v init preview validate generate add doc completions shell")" -- "$cur" ) + ;; + + esac +} && +complete -F _bashly_completions bashly + +# ex: filetype=sh \ No newline at end of file diff --git a/home/dot_local/share/bash-completion/completions/bashly.bash.tmpl b/home/dot_local/share/bash-completion/completions/bashly.bash.tmpl deleted file mode 100644 index 0d5c5812..00000000 --- a/home/dot_local/share/bash-completion/completions/bashly.bash.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- if (lookPath "bashly") -}} -{{- output "bashly" "completions" "--install" -}} -{{- end -}} \ No newline at end of file