diff --git a/.config/neofetch/config.conf b/.config/neofetch/config.conf index cdba4c6..087515a 100644 --- a/.config/neofetch/config.conf +++ b/.config/neofetch/config.conf @@ -19,18 +19,18 @@ print_info() { info "Terminal" term info "Terminal Font" term_font info "CPU" cpu + info "GPU Driver" gpu_driver # Linux/macOS only info "GPU" gpu info "Memory" memory + info "Disk" disk + info "Local IP" local_ip + info "Public IP" public_ip - # info "GPU Driver" gpu_driver # Linux/macOS only # info "CPU Usage" cpu_usage - # info "Disk" disk # info "Battery" battery # info "Font" font # info "Song" song # [[ "$player" ]] && prin "Music Player" "$player" - # info "Local IP" local_ip - # info "Public IP" public_ip # info "Users" users # info "Locale" locale # This only works on glibc systems. @@ -45,7 +45,7 @@ print_info() { # Default: 'off' # Values: 'on', 'off' # Flag: --title_fqdn -title_fqdn="off" +title_fqdn="on" # Kernel diff --git a/.config/vim/rakefile b/.config/vim/rakefile deleted file mode 100644 index 76a85d3..0000000 --- a/.config/vim/rakefile +++ /dev/null @@ -1,61 +0,0 @@ -require 'rake/clean' -require 'fileutils' - -vimFolder = File.expand_path("~/.config/vim") -vimRuntimeFolder = "#{vimFolder}/runtime" -bundles_dir = File.join("#{vimRuntimeFolder}/bundle") -pluginsFile = File.join("#{vimFolder}/plugins.txt") - -CLEAN.include "#{bundles_dir}" - -task :default => ['clean', 'vim:reinstall'] - - -namespace :vim do - - directory "#{bundles_dir}" - desc "reinstalls all vim plugins from #{pluginsFile} into #{bundles_dir}" - task :reinstall do - puts "loading plugins into #{bundles_dir}..." - lines = IO.readlines pluginsFile - puts "Loading #{lines.length} plugins..." - lines.each { |source| - if source[0] != "#" then - loadTask = Rake::Task['vim:downloadPlugin'] - loadTask.invoke source.sub "\n", '' - loadTask.reenable() - end - } - puts "Plugins installed!" - end - - desc "downloads a vim plugin from a git repo, installs it into #{bundles_dir}" - task :downloadPlugin, [:source] => "#{bundles_dir}" do |t, args| - raise "Must specify git repo to pull from." unless args.source not(nil) - dir = gitName args.source - puts "Installing #{dir}...." - Dir.chdir bundles_dir do - sh "git clone #{args.source} #{dir}" - FileUtils.rm_rf(File.join(dir, ".git")) - end - puts "\n\n" - end - - - desc "downloads a new plugin into #{bundles_dir} and adds it to #{pluginsFile}" - task :install, [:sourceName] do |t, args| - raise "Must specify git repo to pull from." unless args.sourceName not(nil) - source = "git://github.com/#{args.sourceName}.git" - Rake::Task['vim:downloadPlugin'].invoke source - puts "Adding to #{pluginsFile}" - File.open pluginsFile, 'a' do |file| - file.puts "#{source}\n" - end - end - -end - -def gitName(gitRepo) - return gitRepo.split('/').last.sub(/\.git$/, '') -end - diff --git a/plugins/001-utilities.sh b/plugins/001-utilities.sh deleted file mode 100644 index 2b76bed..0000000 --- a/plugins/001-utilities.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# symbolic links all files in a directory into the target -files_linkdir() { - local SOURCE=$1; - local DEST=$2; - local FORCE=$3; - - if [[ -d "${SOURCE}" ]]; then - - if ! [[ -z "${FORCE}" ]] || ! [[ -d "${DEST}" ]]; then - files_debug_log "LINKING $SOURCE -> $DEST" - - find "${SOURCE}" -type d | sed "s=${SOURCE}==" | xargs -I {} mkdir -p ${DEST}{}; - find "${SOURCE}" -type f | sed "s=${SOURCE}==" | xargs -I {} ln -fs ${SOURCE}{} ${DEST}{}; - fi - fi - # ln on windows pretty much only works with hardlinks it seems - #ls -lA "${SOURCE}" | grep "^-" | awk '{print $9}' | xargs -I {} ln -vfs "${SOURCE}/{}" "${DEST}/{}" -} diff --git a/plugins/002-config.sh b/plugins/002-config.sh deleted file mode 100644 index 83bf3b8..0000000 --- a/plugins/002-config.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -files_linkdir "${HOME}/.files/.config" "${HOME}/.config" true; - -! [[ -f "${HOME}/.gitconfig" ]] && ln -s "${HOME}/.config/git/.gitconfig" "${HOME}/.gitconfig"; diff --git a/plugins/005-ssh.sh b/plugins/005-ssh.sh deleted file mode 100644 index 729c3b5..0000000 --- a/plugins/005-ssh.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -mkdir -p ${HOME}/.ssh/; -# handy functions - -# Open an ssh tunnel -ssh_tunnel(){ - if [[ -z $1 ]]; then - echo "Takes an ssh config host name and starts an SSH tunnel" - echo "\$1 required: name of an ssh tunnel host" - echo "\$2 optional: run the tunnel as a background job if defined" - return -1 - fi - - if [[ -z $2 ]]; then - ssh -f -N $1 - else - ssh -f -N $1 & - fi -} - -# generate the public key for a private key -function ssh_pubkey(){ - if [[ -z $1 ]]; then - echo "Takes a path to a private key and prints a compatible public key to stdout" - echo "$1 required: path to a private key" - return -1 - fi - - - ssh-keygen -y -f $1 -} - -ssh_newkey() { - local name=$1; - local comment=$2; - local quiet=$3; - - if [[ -z "${name}" ]]; then - echo "ssh_newkey creates a new ssh key with the specified name and comment"; - echo "The new keys are saved in ${HOME}/.ssh//"; - echo "ssh_newkey [comment]"; - exit 255; - fi - - - local algo='ed25519'; - local private_key_path="${HOME}/.ssh/${name}/id.${algo}"; - local public_key_path="${HOME}/.ssh/${name}/id.${algo}.pub"; - local gendate=$(date --rfc-3339=seconds); - - if [[ -d "${HOME}/.ssh/${name}" ]]; then - exit 1; - fi - - mkdir -p ${HOME}/.ssh/${name}; - - ssh-keygen -t "${algo}" -C "$comment -- created ${gendate}" -f "${private_key_path}"; - - echo -e "\n\n"; - echo -e "See your keys here: ${HOME}/.ssh/${name}"; - if [[ -z $(cat "${HOME}/.ssh/config" | grep "Host ${name}") ]]; then - echo "Updating ssh config @ ${HOME}/.ssh/config. Edit to your liking."; - cat <<- EOF >> ${HOME}/.ssh/config - - Host ${name} - IdentityFile ${private_key_path} - UserKnownHostsFile ${HOME}/.ssh/${name}/known_hosts - EOF - fi -} - -ssh_newconfig() { - cat <<- EOF > ${HOME}/.ssh/config - Host * - # verbosity used when logging messages from ssh, QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, DEBUG3 - LogLevel INFO - # if YES, never auto add host keyes and refuses to connecto to hosts that have changed. YES, NO, ASK - StrictHostKeyChecking ask - # known hosts file database location - UserKnownHostsFile ~/.ssh/known_hosts - # timeout in seconds after which if no data has been recieved from the server, ssh will send a keep alive message - ServerAliveInterval 30 - # the number of times to send a keep alive message in a row, only applies to ssh v2 - ServerAliveCountMax 120 - # Shows the ssh key image on connection. YES or NO - VisualHostKey yes - # if the connection should use compression. YES or NO - Compression yes - # allows ssh to prefer one method of auth over another if there are multiple methods available. gssapi-with-mic, hostbased, publickey, keyboard-interactive, password - PreferredAuthentications publickey,password,keyboard-interactive - # send TCP keep alive messages to the host, which lets us know if the connection dies, but it can give false negatives (if the connection goes down temporarily, you'll get disconnected). YES, NO - TCPKeepAlive yes - # refer to: https://github.com/FiloSottile/whosthere/blob/master/README.md - PubkeyAuthentication yes - IdentitiesOnly yes - EOF - -} - -if ! [[ -f ${HOME}/.ssh/config ]]; then - ssh_newconfig -fi diff --git a/plugins/200-golang.sh b/plugins/200-golang.sh deleted file mode 100644 index 8bed0e7..0000000 --- a/plugins/200-golang.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -export GVM_DIR="${HOME}/.gvm" - -if [[ "${FILES_INSTALL_TOOLS}" = "true" ]] && ! [[ -d ${GVM_DIR} ]]; then - # install go version manager - echo "Installing go version manager"; - curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer -o /tmp/gvm-installer.sh; - chmod +x /tmp/gvm-installer.sh && /tmp/gvm-installer.sh; - source ~/.gvm/scripts/gvm; - gvm install go1.17 -B; - gvm use go1.17 --default; -fi - -if [[ -s "${GVM_DIR}/scripts/gvm" ]]; then - source ~/.gvm/scripts/gvm; - [ -s "$GVM_DIR/scripts/bash_completion" ] && \. "$GVM_DIR/scripts/bash_completion"; -fi - diff --git a/plugins/210-node.sh b/plugins/210-node.sh deleted file mode 100644 index 8b95830..0000000 --- a/plugins/210-node.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -export NVM_DIR="$HOME/.config/.nvm"; - -if [[ "${FILES_INSTALL_TOOLS}" = "true" ]] && ! [[ -d ${NVM_DIR} ]]; then - # install node version manager - echo "Installing node version manager"; - git clone --branch "${NVM_VERSION:-v0.39.0}" https://github.com/nvm-sh/nvm.git ${NVM_DIR}; - source ${NVM_DIR}/nvm.sh; - nvm install ${NVM_VERSION:-v14}; - nvm alias default ${NVM_VERSION:-v14}; -fi - -if [[ -s "${NVM_DIR}/nvm.sh" ]]; then - source ${NVM_DIR}/nvm.sh; - [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"; -fi - - - diff --git a/plugins/220-ruby.sh b/plugins/220-ruby.sh deleted file mode 100644 index dd0d1bc..0000000 --- a/plugins/220-ruby.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -export RVM_HOME="${HOME}/.rvm"; -return 0; -if [[ "${FILES_INSTALL_TOOLS}" = "true" ]] && ! [[ -d "${RVM_HOME}" ]]; then - command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -; - command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -; - - curl -sSL https://get.rvm.io | bash -s stable --ruby; -fi - -if [[ -s ${RVM_HOME}/scripts/rvm ]]; then - ! [[ -f ${HOME}/.rvmrc ]] && echo "rvm_silence_path_mismatch_check_flag=1" > ~/.rvmrc; - source ${RVM_HOME}/scripts/rvm; - [[ -s ${RVM_HOME}/scripts/completion ]] && source ${RVM_HOME}/scripts/completion | true; - export PATH=$PATH:$HOME/.rvm/bin; - rvm use ruby-3.0.0 > /dev/null; -fi - diff --git a/plugins/230-rust.sh b/plugins/230-rust.sh deleted file mode 100644 index 6634897..0000000 --- a/plugins/230-rust.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -export RUSTUP_HOME="${HOME}/.config/rust/.rustup"; -export CARGO_HOME="${HOME}/.config/rust/.cargo"; -export PATH=${PATH}:${CARGO_HOME}/bin; - -if [[ "${FILES_INSTALL_TOOLS}" = "true" ]] && ! [[ -d ${CARGO_HOME} ]]; then - # install rust - echo "Installing rustup + rust stable"; - curl -sLSf https://sh.rustup.rs > /tmp/rustup.sh; - chmod +x /tmp/rustup.sh && /tmp/rustup.sh -y --no-modify-path; -fi - -[[ -s "${CARGO_HOME}/env" ]] && source ${CARGO_HOME}/env; - - diff --git a/plugins/500-vim.sh b/plugins/500-vim.sh deleted file mode 100644 index 80fa36a..0000000 --- a/plugins/500-vim.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -export VIM="${HOME}/.config/vim"; -export VIMRUNTIME="${VIM}/runtime"; -export VIM_BUNDLE="${VIM}/runtime/bundle" - -if [[ -d ${VIM} ]]; then - - install_vim_plugins() { - [[ -d ${VIM_BUNDLE} ]] && rm -rf ${VIM_BUNDLE}; - mkdir -p ${VIM_BUNDLE}; - - pushd ${VIM_BUNDLE} - local PLUGINS=$(cat ${VIM}/plugins.txt); - for plugin in ${PLUGINS}; do - if [[ "${plugin:0:3}" = "git" ]]; then - echo "Installing $plugin..."; - git clone -q $plugin > /dev/null & - fi - done - time wait; - popd; - } - - files_linkdir "/usr/share/vim/vim82/" "${VIMRUNTIME}/"; - - ! [[ -f ${HOME}/.vimrc ]] && ln -sf ${VIM}/.vimrc ${HOME}/.vimrc; - - if ! [[ -f "${VIMRUNTIME}/autoload/pathogen.vim" ]]; then - files_debug_log "installing pathogen.vim"; - if ! [[ -d "/tmp/vim-pathogen/" ]]; then - git clone git://github.com/tpope/vim-pathogen.git /tmp/vim-pathogen; - if [[ -d "/tmp/vim-pathogen/autoload" ]]; then - mkdir -p ${VIMRUNTIME}/autoload/; - cp -r /tmp/vim-pathogen/autoload/* ${VIMRUNTIME}/autoload/; - fi - fi - - fi - - if ! [[ -d "${VIMRUNTIME}/bundle" ]]; then - files_debug_log "installing vim plugins..."; - install_vim_plugins - fi - -fi - diff --git a/plugins/asdf/asdf.sh b/plugins/asdf/asdf.sh new file mode 100644 index 0000000..1a71ac7 --- /dev/null +++ b/plugins/asdf/asdf.sh @@ -0,0 +1,22 @@ +#!/bin/env bash + +# Find where asdf should be installed +ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" +ASDF_COMPLETIONS="$ASDF_DIR/completions" + +# If not found, check for Homebrew package +if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f $(which brew 2&>1) ]]; then + ASDF_DIR="$(brew --prefix asdf)" + ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" +fi + +# Load command +if [[ -f "$ASDF_DIR/asdf.sh" ]]; then + . "$ASDF_DIR/asdf.sh" + + # Load completions + if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then + . "$ASDF_COMPLETIONS/asdf.bash" + fi +fi + diff --git a/plugins/brew/brew.sh b/plugins/brew/brew.sh new file mode 100644 index 0000000..afd2220 --- /dev/null +++ b/plugins/brew/brew.sh @@ -0,0 +1,14 @@ +#!/bin/env bash + +export LINUX_BREW_PATH="/home/linuxbrew/.linuxbrew"; + +if ! [[ -d "${LINUX_BREW_PATH}" ]]; then + curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o /tmp/brew_install.sh; + chmod +x /tmp/brew_install.sh; + /tmp/brew_install.sh; + rm -rf /tmp/brew_install.sh; +fi + +[[ -f "${LINUX_BREW_PATH}/bin/brew" ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"; + + diff --git a/plugins/000-base.sh b/plugins/extras/defaults.d/000-base.sh similarity index 96% rename from plugins/000-base.sh rename to plugins/extras/defaults.d/000-base.sh index 891670c..e9081b8 100644 --- a/plugins/000-base.sh +++ b/plugins/extras/defaults.d/000-base.sh @@ -33,7 +33,6 @@ bind '"\e\C-l"':clear-screen; # --l export LESS='-iMR'; # Case insensite search, verbose prompting and raw output export PAGER=less; # Used to display text / man files -# export POWERLINE_CONFIG_COMMAND=~/tools/powerline/powerline/scripts/powerline-config export GPG_TTY=$(tty); export GIT_EDITOR=vim; @@ -50,6 +49,9 @@ if [[ -d "${HOME}/.dotnet" ]]; then export PATH=${DOTNETPATH}:${PATH}; fi +if [[ -d "${HOME}/.bin" ]]; then + PATH=${HOME}/.bin:${PATH}; +fi # http://stackoverflow.com/questions/410616/increasing-the-maximum-number-of-tcp-ip-connections-in-linux # run these to increase concurrent connections in linux diff --git a/plugins/899-helpers.sh b/plugins/extras/defaults.d/899-helpers.sh similarity index 100% rename from plugins/899-helpers.sh rename to plugins/extras/defaults.d/899-helpers.sh diff --git a/plugins/900-prompt.sh b/plugins/extras/defaults.d/900-prompt.sh similarity index 100% rename from plugins/900-prompt.sh rename to plugins/extras/defaults.d/900-prompt.sh diff --git a/plugins/extras/extras.sh b/plugins/extras/extras.sh new file mode 100644 index 0000000..d6e5453 --- /dev/null +++ b/plugins/extras/extras.sh @@ -0,0 +1,15 @@ +#!/bin/env bash + +if [[ -z "${FILES_EXTRAS_DIR}" ]]; then + export FILES_EXTRAS_DIR="${HOME}/.files-extras"; +fi + + +if ! [[ -d "${FILES_EXTRAS_DIR}" ]]; then + mkdir -p "${FILES_EXTRAS_DIR}"; + files_linkdir "${FILES_PLUGIN_ROOT}/default.d/" "${FILES_EXTRAS_DIR}/"; +fi + +for file in "${FILES_EXTRAS_DIR}"/*; do + [[ -f "${file}" ]] && source "${file}"; +done; diff --git a/.config/git/.gitconfig b/plugins/git-extras/defaults.d/.gitconfig similarity index 95% rename from .config/git/.gitconfig rename to plugins/git-extras/defaults.d/.gitconfig index 51759d2..3bb7bf3 100644 --- a/.config/git/.gitconfig +++ b/plugins/git-extras/defaults.d/.gitconfig @@ -1,6 +1,6 @@ [alias] # View abbreviated SHA, description, and history graph - l = log --pretty=format:'%Cblue%h -%d %Cgreen%an %Creset%s - %Cred%GS' --abbrev-commit --date=relative --branches --graph -n 45 + ls = log --pretty=format:'%Cblue%h -%d %Cgreen%an %Creset%s - %Cred%GS' --abbrev-commit --date=relative --branches --graph -n 45 # View the current working tree status using the short format s = status -s @@ -15,8 +15,7 @@ # Pull in remote changes for the current repository and all its submodules p = !"git pull; git submodule foreach git pull origin master" - # Clone a repository including all submodules - c = clone --recursive + c = commit -pm cpv = commit -pmv @@ -76,7 +75,7 @@ trustExitCode = false [advice] - statusHints = false + statusHints = true [apply] # Detect whitespace errors when applying a patch diff --git a/.config/git/.githooks/pre-commit b/plugins/git-extras/defaults.d/.githooks/pre-commit similarity index 100% rename from .config/git/.githooks/pre-commit rename to plugins/git-extras/defaults.d/.githooks/pre-commit diff --git a/.config/git/.githooks/pre-push b/plugins/git-extras/defaults.d/.githooks/pre-push similarity index 100% rename from .config/git/.githooks/pre-push rename to plugins/git-extras/defaults.d/.githooks/pre-push diff --git a/.config/git/.gitignore b/plugins/git-extras/defaults.d/.gitignore similarity index 100% rename from .config/git/.gitignore rename to plugins/git-extras/defaults.d/.gitignore diff --git a/.config/git/.gitmessage b/plugins/git-extras/defaults.d/.gitmessage similarity index 100% rename from .config/git/.gitmessage rename to plugins/git-extras/defaults.d/.gitmessage diff --git a/plugins/git-extras/git-extras.sh b/plugins/git-extras/git-extras.sh new file mode 100644 index 0000000..5a51c32 --- /dev/null +++ b/plugins/git-extras/git-extras.sh @@ -0,0 +1,8 @@ +#!/bin/env bash + +export GIT_EXTRAS_DIR="${FILES_USER_CONFIG}/git"; + +[[ -d "${GIT_EXTRAS_DIR}" ]] || mkdir -p "${GIT_EXTRAS_DIR}"; +[[ -f "${HOME}/.gitconfig" ]] || ln -sf "${FILES_PLUGIN_ROOT}/defaults.d/.gitconfig" "${HOME}/.gitconfig"; + +files_linkdir "${FILES_PLUGIN_ROOT}/defaults.d" "${GIT_EXTRAS_DIR}" true; diff --git a/plugins/helm/helm.sh b/plugins/helm/helm.sh new file mode 100644 index 0000000..39b4605 --- /dev/null +++ b/plugins/helm/helm.sh @@ -0,0 +1,4 @@ +#!/bin/env bash +if [[ -f "$(which helm 2&>1)" ]]; then + source <(helm completion zsh) +fi diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md new file mode 100644 index 0000000..f6651c8 --- /dev/null +++ b/plugins/kubectl/README.md @@ -0,0 +1,130 @@ +# Kubectl plugin + +This plugin adds completion for the [Kubernetes cluster manager](https://kubernetes.io/docs/reference/kubectl/kubectl/), +as well as some aliases for common kubectl commands. + +To use it, add `kubectl` to the plugins array in your zshrc file: + +```zsh +plugins=(... kubectl) +``` + +## Aliases + +| Alias | Command | Description | +|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------| +| k | `kubectl` | The kubectl command | +| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces | +| kaf | `kubectl apply -f` | Apply a YML file | +| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container | +| | | **Manage configuration quickly to switch contexts between local, dev and staging** | +| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file | +| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig | +| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig | +| kccc | `kubectl config current-context` | Display the current-context | +| kcgc | `kubectl config get-contexts` | List of contexts available +| | | **General aliases** | +| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector | +| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument | +| | | **Pod management** | +| kgp | `kubectl get pods` | List all pods in ps output format | +| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes | +| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included | +| kep | `kubectl edit pods` | Edit pods from the default editor | +| kdp | `kubectl describe pods` | Describe all pods | +| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments | +| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` | +| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` | +| | | **Service management** | +| kgs | `kubectl get svc` | List all services in ps output format | +| kgsw | `kgs --watch` | After listing all services, watch for changes | +| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information | +| kes | `kubectl edit svc` | Edit services(svc) from the default editor | +| kds | `kubectl describe svc` | Describe all services in detail | +| kdels | `kubectl delete svc` | Delete all services matching passed argument | +| | | **Ingress management** | +| kgi | `kubectl get ingress` | List ingress resources in ps output format | +| kei | `kubectl edit ingress` | Edit ingress resource from the default editor | +| kdi | `kubectl describe ingress` | Describe ingress resource in detail | +| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument | +| | | **Namespace management** | +| kgns | `kubectl get namespaces` | List the current namespaces in a cluster | +| kcn | `kubectl config set-context --current --namespace` | Change current namespace | +| kens | `kubectl edit namespace` | Edit namespace resource from the default editor | +| kdns | `kubectl describe namespace` | Describe namespace resource in detail | +| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace | +| | | **ConfigMap management** | +| kgcm | `kubectl get configmaps` | List the configmaps in ps output format | +| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor | +| kdcm | `kubectl describe configmap` | Describe configmap resource in detail | +| kdelcm | `kubectl delete configmap` | Delete the configmap | +| | | **Secret management** | +| kgsec | `kubectl get secret` | Get secret for decoding | +| kdsec | `kubectl describe secret` | Describe secret resource in detail | +| kdelsec | `kubectl delete secret` | Delete the secret | +| | | **Deployment management** | +| kgd | `kubectl get deployment` | Get the deployment | +| kgdw | `kgd --watch` | After getting the deployment, watch for changes | +| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information | +| ked | `kubectl edit deployment` | Edit deployment resource from the default editor | +| kdd | `kubectl describe deployment` | Describe deployment resource in detail | +| kdeld | `kubectl delete deployment` | Delete the deployment | +| ksd | `kubectl scale deployment` | Scale a deployment | +| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment | +| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime | +| | | **Rollout management** | +| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment | +| krh | `kubectl rollout history` | Check the revisions of this deployment | +| kru | `kubectl rollout undo` | Rollback to the previous revision | +| | | **Port forwarding** | +| kpf | `kubectl port-forward` | Forward one or more local ports to a pod | +| | | **Tools for accessing all information** | +| kga | `kubectl get all` | List all resources in ps format | +| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces | +| | | **Logs** | +| kl | `kubectl logs` | Print the logs for a container or resource | +| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) | +| | | **File copy** | +| kcp | `kubectl cp` | Copy files and directories to and from containers | +| | | **Node management** | +| kgno | `kubectl get nodes` | List the nodes in ps output format | +| keno | `kubectl edit node` | Edit nodes resource from the default editor | +| kdno | `kubectl describe node` | Describe node resource in detail | +| kdelno | `kubectl delete node` | Delete the node | +| | | **Persistent Volume Claim management** | +| kgpvc | `kubectl get pvc` | List all PVCs | +| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | +| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | +| kdpvc | `kubectl describe pvc` | Describe all pvcs | +| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | +| | | **StatefulSets management** | +| kgss | `kubectl get statefulset` | List the statefulsets in ps format | +| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | +| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | +| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor | +| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail | +| kdelss | `kubectl delete statefulset` | Delete the statefulset | +| ksss | `kubectl scale statefulset` | Scale a statefulset | +| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | +| | | **Service Accounts management** | +| kdsa | `kubectl describe sa` | Describe a service account in details | +| kdelsa | `kubectl delete sa` | Delete the service account | +| | | **DaemonSet management** | +| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format | +| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes | +| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor | +| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail | +| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument | +| | | **CronJob management** | +| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format | +| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor | +| kdcj | `kubectl describe cronjob` | Describe a CronJob in details | +| kdelcj | `kubectl delete cronjob` | Delete the CronJob | + +## Wrappers + +This plugin provides 3 wrappers to colorize kubectl output in JSON and YAML using various tools (which must be installed): + +- `kj`: JSON, colorized with [`jq`](https://stedolan.github.io/jq/). +- `kjx`: JSON, colorized with [`fx`](https://github.com/antonmedv/fx). +- `ky`: YAML, colorized with [`yh`](https://github.com/andreazorzetto/yh). diff --git a/plugins/kubectl/kubectl.sh b/plugins/kubectl/kubectl.sh new file mode 100644 index 0000000..760eabe --- /dev/null +++ b/plugins/kubectl/kubectl.sh @@ -0,0 +1,182 @@ +#!/bin/env bash + +if [[ -f "$(which kubectl)" ]]; then + __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" + + if [[ ! -f $__KUBECTL_COMPLETION_FILE || ! -s $__KUBECTL_COMPLETION_FILE ]]; then + kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE + fi + + [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE + + unset __KUBECTL_COMPLETION_FILE +fi + +# This command is used a LOT both below and in daily life +alias k=kubectl + +# Execute a kubectl command against all namespaces +alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca' + +# Apply a YML file +alias kaf='kubectl apply -f' + +# Drop into an interactive terminal on a container +alias keti='kubectl exec -ti' + +# Manage configuration quickly to switch contexts between local, dev ad staging. +alias kcuc='kubectl config use-context' +alias kcsc='kubectl config set-context' +alias kcdc='kubectl config delete-context' +alias kccc='kubectl config current-context' + +# List all contexts +alias kcgc='kubectl config get-contexts' + +# General aliases +alias kdel='kubectl delete' +alias kdelf='kubectl delete -f' + +# Pod management. +alias kgp='kubectl get pods' +alias kgpa='kubectl get pods --all-namespaces' +alias kgpw='kgp --watch' +alias kgpwide='kgp -o wide' +alias kep='kubectl edit pods' +alias kdp='kubectl describe pods' +alias kdelp='kubectl delete pods' +alias kgpall='kubectl get pods --all-namespaces -o wide' + +# get pod by label: kgpl "app=myapp" -n myns +alias kgpl='kgp -l' + +# get pod by namespace: kgpn kube-system" +alias kgpn='kgp -n' + +# Service management. +alias kgs='kubectl get svc' +alias kgsa='kubectl get svc --all-namespaces' +alias kgsw='kgs --watch' +alias kgswide='kgs -o wide' +alias kes='kubectl edit svc' +alias kds='kubectl describe svc' +alias kdels='kubectl delete svc' + +# Ingress management +alias kgi='kubectl get ingress' +alias kgia='kubectl get ingress --all-namespaces' +alias kei='kubectl edit ingress' +alias kdi='kubectl describe ingress' +alias kdeli='kubectl delete ingress' + +# Namespace management +alias kgns='kubectl get namespaces' +alias kens='kubectl edit namespace' +alias kdns='kubectl describe namespace' +alias kdelns='kubectl delete namespace' +alias kcn='kubectl config set-context --current --namespace' + +# ConfigMap management +alias kgcm='kubectl get configmaps' +alias kgcma='kubectl get configmaps --all-namespaces' +alias kecm='kubectl edit configmap' +alias kdcm='kubectl describe configmap' +alias kdelcm='kubectl delete configmap' + +# Secret management +alias kgsec='kubectl get secret' +alias kgseca='kubectl get secret --all-namespaces' +alias kdsec='kubectl describe secret' +alias kdelsec='kubectl delete secret' + +# Deployment management. +alias kgd='kubectl get deployment' +alias kgda='kubectl get deployment --all-namespaces' +alias kgdw='kgd --watch' +alias kgdwide='kgd -o wide' +alias ked='kubectl edit deployment' +alias kdd='kubectl describe deployment' +alias kdeld='kubectl delete deployment' +alias ksd='kubectl scale deployment' +alias krsd='kubectl rollout status deployment' +kres(){ + kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S) +} + +# Rollout management. +alias kgrs='kubectl get rs' +alias krh='kubectl rollout history' +alias kru='kubectl rollout undo' + +# Statefulset management. +alias kgss='kubectl get statefulset' +alias kgssa='kubectl get statefulset --all-namespaces' +alias kgssw='kgss --watch' +alias kgsswide='kgss -o wide' +alias kess='kubectl edit statefulset' +alias kdss='kubectl describe statefulset' +alias kdelss='kubectl delete statefulset' +alias ksss='kubectl scale statefulset' +alias krsss='kubectl rollout status statefulset' + +# Port forwarding +alias kpf="kubectl port-forward" + +# Tools for accessing all information +alias kga='kubectl get all' +alias kgaa='kubectl get all --all-namespaces' + +# Logs +alias kl='kubectl logs' +alias kl1h='kubectl logs --since 1h' +alias kl1m='kubectl logs --since 1m' +alias kl1s='kubectl logs --since 1s' +alias klf='kubectl logs -f' +alias klf1h='kubectl logs --since 1h -f' +alias klf1m='kubectl logs --since 1m -f' +alias klf1s='kubectl logs --since 1s -f' + +# File copy +alias kcp='kubectl cp' + +# Node Management +alias kgno='kubectl get nodes' +alias keno='kubectl edit node' +alias kdno='kubectl describe node' +alias kdelno='kubectl delete node' + +# PVC management. +alias kgpvc='kubectl get pvc' +alias kgpvca='kubectl get pvc --all-namespaces' +alias kgpvcw='kgpvc --watch' +alias kepvc='kubectl edit pvc' +alias kdpvc='kubectl describe pvc' +alias kdelpvc='kubectl delete pvc' + +# Service account management. +alias kdsa="kubectl describe sa" +alias kdelsa="kubectl delete sa" + +# DaemonSet management. +alias kgds='kubectl get daemonset' +alias kgdsw='kgds --watch' +alias keds='kubectl edit daemonset' +alias kdds='kubectl describe daemonset' +alias kdelds='kubectl delete daemonset' + +# CronJob management. +alias kgcj='kubectl get cronjob' +alias kecj='kubectl edit cronjob' +alias kdcj='kubectl describe cronjob' +alias kdelcj='kubectl delete cronjob' + +# Only run if the user actually has kubectl installed +if (( ${+_comps[kubectl]} )); then + kj() { kubectl "$@" -o json | jq; } + kjx() { kubectl "$@" -o json | fx; } + ky() { kubectl "$@" -o yaml | yh; } + + compdef kj=kubectl + compdef kjx=kubectl + compdef ky=kubectl +fi diff --git a/plugins/ssh/defaults.d/config b/plugins/ssh/defaults.d/config new file mode 100644 index 0000000..3fa9c5c --- /dev/null +++ b/plugins/ssh/defaults.d/config @@ -0,0 +1,25 @@ +Host * + # verbosity used when logging messages from ssh, QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, DEBUG3 + LogLevel INFO + # if YES, never auto add host keyes and refuses to connecto to hosts that have changed. YES, NO, ASK + StrictHostKeyChecking ask + # known hosts file database location + UserKnownHostsFile ~/.ssh/known_hosts + # timeout in seconds after which if no data has been recieved from the server, ssh will send a keep alive message + ServerAliveInterval 30 + # the number of times to send a keep alive message in a row, only applies to ssh v2 + ServerAliveCountMax 120 + # Shows the ssh key image on connection. YES or NO + VisualHostKey yes + # if the connection should use compression. YES or NO + Compression yes + # allows ssh to prefer one method of auth over another if there are multiple methods available. gssapi-with-mic, hostbased, publickey, keyboard-interactive, password + PreferredAuthentications publickey,password,keyboard-interactive + # send TCP keep alive messages to the host, which lets us know if the connection dies, but it can give false negatives (if the connection goes down temporarily, you'll get disconnected). YES, NO + TCPKeepAlive yes + # refer to: https://github.com/FiloSottile/whosthere/blob/master/README.md + PubkeyAuthentication yes + IdentitiesOnly yes + AddKeysToAgent yes + UseKeychain yes + diff --git a/plugins/ssh/ssh.sh b/plugins/ssh/ssh.sh new file mode 100644 index 0000000..6aba83e --- /dev/null +++ b/plugins/ssh/ssh.sh @@ -0,0 +1,75 @@ +#!/bin/env bash + +export SSH_DIR="${HOME}/.ssh"; + +[[ -d "${SSH_DIR}" ]] || mkdir -p "${SSH_DIR}"; + +files_linkdir "${FILES_PLUGIN_ROOT}/defaults.d" "${SSH_DIR}"; + + +# Open an ssh tunnel +ssh_tunnel(){ + if [[ -z $1 ]]; then + echo "Takes an ssh config host name and starts an SSH tunnel"; + echo "\$1 required: name of an ssh tunnel host"; + echo "\$2 optional: run the tunnel as a background job if defined"; + return -1; + fi + + if [[ -z $2 ]]; then + ssh -f -N $1; + else + ssh -f -N $1 & + fi +} + +# generate the public key for a private key +ssh_pubkey(){ + if [[ -z $1 ]]; then + echo "Takes a path to a private key and prints a compatible public key to stdout"; + echo "$1 required: path to a private key"; + return -1; + fi + + + ssh-keygen -y -f $1; +} + +ssh_newkey() { + local name=$1; + local comment=$2; + local quiet=$3; + + if [[ -z "${name}" ]]; then + echo "ssh_newkey creates a new ssh key with the specified name and comment"; + echo "The new keys are saved in ${HOME}/.ssh//"; + echo "ssh_newkey [comment]"; + exit 255; + fi + + + local algo='ed25519'; + local private_key_path="${HOME}/.ssh/${name}/id.${algo}"; + local public_key_path="${HOME}/.ssh/${name}/id.${algo}.pub"; + local gendate=$(date --rfc-3339=seconds); + + if [[ -d "${HOME}/.ssh/${name}" ]]; then + exit 1; + fi + + mkdir -p ${HOME}/.ssh/${name}; + + ssh-keygen -t "${algo}" -C "$comment -- created ${gendate}" -f "${private_key_path}"; + + echo -e "\n\n"; + echo -e "See your keys here: ${HOME}/.ssh/${name}"; + if [[ -z $(cat "${HOME}/.ssh/config" | grep "Host ${name}") ]]; then + echo "Updating ssh config @ ${HOME}/.ssh/config. Edit to your liking."; + cat <<- EOF >> ${HOME}/.ssh/config + + Host ${name} + IdentityFile ${private_key_path} + UserKnownHostsFile ${HOME}/.ssh/${name}/known_hosts + EOF + fi +} diff --git a/plugins/starship/defaults.d/starship.toml b/plugins/starship/defaults.d/starship.toml new file mode 100644 index 0000000..efa4855 --- /dev/null +++ b/plugins/starship/defaults.d/starship.toml @@ -0,0 +1,15 @@ +# Inserts a blank line between shell prompts +add_newline = true + +scan_timeout = 50 + +format = "$all" + +# Replace the "❯" symbol in the prompt with "➜" +[character] # The name of the module we are configuring is "character" +success_symbol = "[➜](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green" + + +# Disable the package module, hiding it from the prompt completely +[package] +disabled = true diff --git a/plugins/starship/starship.sh b/plugins/starship/starship.sh new file mode 100644 index 0000000..4e8123b --- /dev/null +++ b/plugins/starship/starship.sh @@ -0,0 +1,32 @@ +#!/bin/env bash + +if ! [[ -f "$(which starship)" ]] && [[ -f "$(which brew)" ]]; then + brew install starship; +fi + +if [[ -f "$(which starship)" ]]; then + export STARSHIP_CONFIG_DIR="${FILES_USER_CONFIG}/starship"; + export STARSHIP_CACHE="${STARSHIP_CONFIG_DIR}/cache"; + + + files_debug_log "[starship] installing default config"; + files_linkdir "${FILES_PLUGIN_ROOT}/defaults.d/" "${STARSHIP_CONFIG_DIR}/"; + + starship_run() { + local shell=${1:-bash}; + eval "$(starship init ${1})"; + } + + starship_install() { + local target=${1}; + local shell=${2:-bash}; + + if [[ -f "${target}" ]] && [[ -z "$(cat ${target} | grep 'starship_run')" ]]; then + echo "starship_run ${shell}" >> ${target}; + fi + } + + [[ -f "${HOME}/.bashrc" ]] && starship_install "${HOME}/.bashrc"; + [[ -f "${HOME}/.bash_profile" ]] && starship_install "${HOME}/.bash_profile"; + [[ -f "${HOME}/.profile" ]] && starship_install "${HOME}/.profile"; +fi diff --git a/.config/vim/.NERDTreeBookmarks b/plugins/vim/config.d/.NERDTreeBookmarks similarity index 100% rename from .config/vim/.NERDTreeBookmarks rename to plugins/vim/config.d/.NERDTreeBookmarks diff --git a/.config/vim/.ctags b/plugins/vim/config.d/.ctags similarity index 100% rename from .config/vim/.ctags rename to plugins/vim/config.d/.ctags diff --git a/.config/vim/.vimrc b/plugins/vim/config.d/.vimrc similarity index 100% rename from .config/vim/.vimrc rename to plugins/vim/config.d/.vimrc diff --git a/.config/vim/plugins.txt b/plugins/vim/config.d/plugins.txt similarity index 100% rename from .config/vim/plugins.txt rename to plugins/vim/config.d/plugins.txt diff --git a/plugins/vim/vim.sh b/plugins/vim/vim.sh new file mode 100644 index 0000000..e55a507 --- /dev/null +++ b/plugins/vim/vim.sh @@ -0,0 +1,67 @@ +#!/bin/env bash + +if [[ -d "${FILES_USER_CONFIG}/vim" ]]; then + export VIM="${FILES_USER_CONFIG}/vim"; + export VIMRUNTIME="${VIM}/runtime"; + export VIM_BUNDLE="${VIM}/runtime/bundle"; + export VIM_SOURCE="${VIM}/.source"; + + vim_install_plugins() { + local PATHOGEN_TMP=="${VIM_SOURCE}/vim-pathogen"; + if ! [[ -f "${VIMRUNTIME}/autoload/pathogen.vim" ]]; then + files_debug_log "installing pathogen.vim"; + if ! [[ -d ${PATHOGEN_TMP} ]]; then + git clone git://github.com/tpope/vim-pathogen.git ${PATHOGEN_TMP}; + mkdir -p ${PATHOGEN_TMP}/autoload/; + cp -r ${PATHOGEN_TMP}/autoload/* ${VIMRUNTIME}/autoload/; + fi + fi + + + [[ -d ${VIM_BUNDLE} ]] && return 0; + files_debug_log "installing vim plugins..."; + + mkdir -p ${VIM_BUNDLE}; + pushd ${VIM_BUNDLE} + local PLUGINS=$(cat ${VIM}/plugins.txt); + for plugin in ${PLUGINS}; do + if [[ "${plugin:0:3}" = "git" ]]; then + echo "Installing $plugin..."; + git clone -q $plugin > /dev/null & + fi + done + time wait; + popd; + } + + vim_setup_runtime() { + [[ -d ${VIMRUNTIME} ]] && return 0; + files_debug_log "installing vim runtime files..."; + ! [[ -d "${VIM_SOURCE}" ]] && git clone https://github.com/vim/vim.git --branch "${VIM_VERSION:-v8.2.3551}" ${VIM_SOURCE}; + files_linkdir "${VIM_SOURCE}/runtime/" "${VIMRUNTIME}/"; + } + + vim_setup_config() { + [[ -d ${VIM} ]] && return 0; + files_debug_log "installing vim config files..."; + files_linkdir "${FILES_PLUGIN_ROOT}/config.d/" ${VIM}; + } + + vim_setup() { + ! [[ -f ${HOME}/.vimrc ]] && ln -sf ${VIM}/.vimrc ${HOME}/.vimrc; + + vim_setup_config; + vim_setup_runtime; + vim_install_plugins; + } + + vim_resetup() { + [[ -d ${VIMRUNTIME} ]] && rm -rf ${VIMRUNTIME}; + + vim_setup; + } + + vim_setup; +fi + + diff --git a/plugins/zzzz-plugins.sh b/plugins/zzzz-plugins.sh deleted file mode 100644 index e944845..0000000 --- a/plugins/zzzz-plugins.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -load_plugins $HOME/.files-plugins; diff --git a/sourceme.sh b/sourceme.sh index 502f401..5684d17 100644 --- a/sourceme.sh +++ b/sourceme.sh @@ -1,44 +1,72 @@ #!/bin/sh -export FILES_INSTALL_TOOLS=${FILES_INSTALL_TOOLS:-false}; - -function files_debug_log() { +# debug logging +files_debug_log() { if ! [[ -z "${FILES_DEBUG}" ]]; then echo -e "# [INFO] $@"; fi } -function load_plugins() { - if [[ -d "${1}" ]]; then - for plugin in ${1}/*; do - if [[ -s $plugin ]]; then - files_debug_log "loading $plugin"; - source $plugin; - elif [[ -d $plugin ]] && [[ -f "$plugin/setup.sh" ]]; then - files_debug_log "loading directory $plugin"; - source $plugin/setup.sh; - fi - done - elif [[ -s "${1}" ]]; then - source $1; +# symbolic links all files in a directory into the target +files_linkdir() { + local SOURCE=$1; + local DEST=$2; + local FORCE=$3; + + if [[ -d "${SOURCE}" ]]; then + if ! [[ -z "${FORCE}" ]] || ! [[ -d "${DEST}" ]]; then + files_debug_log "LINKING $SOURCE -> $DEST" + mkdir -p ${DEST}; + find "${SOURCE}" -type d | sed "s=${SOURCE}==" | xargs -I {} mkdir -p ${DEST}{}; + find "${SOURCE}" -type f | sed "s=${SOURCE}==" | xargs -I {} ln -fs ${SOURCE}{} ${DEST}{}; + fi + fi + # ln on windows pretty much only works with hardlinks it seems + #ls -lA "${SOURCE}" | grep "^-" | awk '{print $9}' | xargs -I {} ln -vfs "${SOURCE}/{}" "${DEST}/{}" +} + +files_install() { + local target=${1}; + local FILES_SOURCEME="[[ -s \"\${HOME}/.files/sourceme.sh\" ]] && source \${HOME}/.files/sourceme.sh"; + + if [[ -f "${target}" ]]; then + if [[ -z "$(cat ${target} | grep 'sourceme.sh')" ]]; then + files_debug_log "[files_install] installing myself to $target"; + echo ${FILES_SOURCEME} >> ${target}; + fi fi } -function reload_env() { +load_env() { files_debug_log "DEBUG MODE IS ENABLED. Turn if off via:\nunset FILES_DEBUG\n" + if [[ -d "${1}" ]]; then + export HOME=${1}; + fi + + export FILES_ROOT="${HOME}/.files"; + export FILES_USER_CONFIG="${HOME}/.config"; - export HOME=${1:-$PWD} + if [[ -z "${FILES_PLUGINS}" ]]; then + export FILES_PLUGINS=("brew" "ssh" "vim" "extras" "git-extras" "asdf" "helm" "starship"); + fi files_debug_log "\$HOME='$HOME'"; # load plugns - load_plugins "$HOME/.files/plugins"; + for plugin in ${FILES_PLUGINS[@]}; do + export FILES_PLUGIN_ROOT="${FILES_ROOT}/plugins/${plugin}"; + if [[ -f "${FILES_PLUGIN_ROOT}/${plugin}.sh" ]]; then + files_debug_log "[PLUGIN] LOADING ${plugin} @ ${FILES_PLUGIN_ROOT}"; + source "${FILES_PLUGIN_ROOT}/${plugin}.sh"; + fi + unset FILES_PLUGIN_ROOT; + done + files_linkdir "${FILES_ROOT}/.config" ${FILES_USER_CONFIG}; - if [[ -d "${HOME}/.bin" ]]; then - PATH=${HOME}/.bin:${PATH}; - fi + [[ -f "${HOME}/.bashrc" ]] && files_install "${HOME}/.bashrc"; + [[ -f "${HOME}/.bash_profile" ]] && files_install "${HOME}/.bash_profile"; + [[ -f "${HOME}/.profile" ]] && files_install "${HOME}/.profile"; } - -reload_env +load_env