Loading dotrc/.bashrc +22 −22 Original line number Diff line number Diff line Loading @@ -10,6 +10,28 @@ fi export BASHRC_CONFIG="$HOME/.bashrc.d" export BASHRC_LASTUPDATE="${BASHRC_CONFIG}/.last-update" # +------------------------------------------------- # | Runtime # +------------------------------------------------- # Find source root directory function __getBashRCSourceRoot() { SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" export BASHRC_SOURCE_ROOT="${DIR}" } __getBashRCSourceRoot export BASHRC_VERSION=$(cd "$BASHRC_SOURCE_ROOT" && git log --pretty="%h" -n1 HEAD) export PATH="$PATH:${BASHRC_SOURCE_ROOT}/../bin:${BASHRC_SOURCE_ROOT}/../vendors" # +------------------------------------------------- # | LDAP Config # +------------------------------------------------- Loading Loading @@ -102,28 +124,6 @@ if [ "$TERM" != 'linux' ]; then export TERM=xterm-256color fi # +------------------------------------------------- # | Runtime # +------------------------------------------------- # Find source root directory function __getBashRCSourceRoot() { SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" export BASHRC_SOURCE_ROOT="${DIR}" } __getBashRCSourceRoot export BASHRC_VERSION=$(cd "$BASHRC_SOURCE_ROOT" && git log --pretty="%h" -n1 HEAD) export PATH="$PATH:${BASHRC_SOURCE_ROOT}/../bin:${BASHRC_SOURCE_ROOT}/../vendors" # +------------------------------------------------- # | Components Loading # +------------------------------------------------- Loading vendors/project-aliases 0 → 100755 +32 −0 Original line number Diff line number Diff line #!/bin/bash # # @author Hermann Mayer <hermann.mayer92@gmail.com> # # $1 - The search path, Default: CWD ROOT_FILES=".editorconfig\|README*\|Makefile\|.gitlab-ci.yml\|.gitignore" EXCLUDE_WORDS1="0ld|old|wiki|test|dist|src|deploy|vendor|config|build|backup" EXCLUDE_WORDS2="tmp$|log$|doc$" EXCLUDE_PATTERNS="\/\.|(\/[a-z0-9]\/)|(\/[a-z]{0,2}$)" EXCLUDE="${EXCLUDE_WORDS1}|${EXCLUDE_WORDS2}|${EXCLUDE_PATTERNS}" if [ -z "${SEARCH_DEPTH}" ]; then SEARCH_DEPTH=4 fi if [ -n "${1}" ]; then cd "${1}" fi # Find all project roots, let only the unique pass and sort out all excludes find . -maxdepth ${SEARCH_DEPTH} -type f \ -regex ".*\(${ROOT_FILES}\)" \ | rev | cut -d '/' -f2- | rev \ | grep -viP "${EXCLUDE}" \ | sort -u \ | while IFS='' read path; do alias=$(echo "${path}" | rev | cut -d '/' -f-2 | rev \ | sed 's#^./##g' | sed 's#[^A-Za-z0-9]#-#g' \ | tr '[:upper:]' '[:lower:]') printf "alias p-%s='cd \"%s\"';\n" "${alias}" "$(readlink -f "${path}")" done Loading
dotrc/.bashrc +22 −22 Original line number Diff line number Diff line Loading @@ -10,6 +10,28 @@ fi export BASHRC_CONFIG="$HOME/.bashrc.d" export BASHRC_LASTUPDATE="${BASHRC_CONFIG}/.last-update" # +------------------------------------------------- # | Runtime # +------------------------------------------------- # Find source root directory function __getBashRCSourceRoot() { SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" export BASHRC_SOURCE_ROOT="${DIR}" } __getBashRCSourceRoot export BASHRC_VERSION=$(cd "$BASHRC_SOURCE_ROOT" && git log --pretty="%h" -n1 HEAD) export PATH="$PATH:${BASHRC_SOURCE_ROOT}/../bin:${BASHRC_SOURCE_ROOT}/../vendors" # +------------------------------------------------- # | LDAP Config # +------------------------------------------------- Loading Loading @@ -102,28 +124,6 @@ if [ "$TERM" != 'linux' ]; then export TERM=xterm-256color fi # +------------------------------------------------- # | Runtime # +------------------------------------------------- # Find source root directory function __getBashRCSourceRoot() { SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" export BASHRC_SOURCE_ROOT="${DIR}" } __getBashRCSourceRoot export BASHRC_VERSION=$(cd "$BASHRC_SOURCE_ROOT" && git log --pretty="%h" -n1 HEAD) export PATH="$PATH:${BASHRC_SOURCE_ROOT}/../bin:${BASHRC_SOURCE_ROOT}/../vendors" # +------------------------------------------------- # | Components Loading # +------------------------------------------------- Loading
vendors/project-aliases 0 → 100755 +32 −0 Original line number Diff line number Diff line #!/bin/bash # # @author Hermann Mayer <hermann.mayer92@gmail.com> # # $1 - The search path, Default: CWD ROOT_FILES=".editorconfig\|README*\|Makefile\|.gitlab-ci.yml\|.gitignore" EXCLUDE_WORDS1="0ld|old|wiki|test|dist|src|deploy|vendor|config|build|backup" EXCLUDE_WORDS2="tmp$|log$|doc$" EXCLUDE_PATTERNS="\/\.|(\/[a-z0-9]\/)|(\/[a-z]{0,2}$)" EXCLUDE="${EXCLUDE_WORDS1}|${EXCLUDE_WORDS2}|${EXCLUDE_PATTERNS}" if [ -z "${SEARCH_DEPTH}" ]; then SEARCH_DEPTH=4 fi if [ -n "${1}" ]; then cd "${1}" fi # Find all project roots, let only the unique pass and sort out all excludes find . -maxdepth ${SEARCH_DEPTH} -type f \ -regex ".*\(${ROOT_FILES}\)" \ | rev | cut -d '/' -f2- | rev \ | grep -viP "${EXCLUDE}" \ | sort -u \ | while IFS='' read path; do alias=$(echo "${path}" | rev | cut -d '/' -f-2 | rev \ | sed 's#^./##g' | sed 's#[^A-Za-z0-9]#-#g' \ | tr '[:upper:]' '[:lower:]') printf "alias p-%s='cd \"%s\"';\n" "${alias}" "$(readlink -f "${path}")" done