From a090b02a21df5d04f3359a79d14eff3b4d72d934 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 15 Oct 2023 15:22:44 +0300 Subject: [PATCH] .bashrc, .shellrc: Move `cdgitpath` It doesn't contain any bash-related funcionality. --- .bashrc | 20 -------------------- .shellrc | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.bashrc b/.bashrc index ef3423f..85cb4d8 100644 --- a/.bashrc +++ b/.bashrc @@ -196,26 +196,6 @@ trap '[ "$VIRTUAL_ENV" ] && deactivate' EXIT if test -x /usr/bin/git >/dev/null 2>&1; then - # chdir to a directory - cdgitpath() { - if [ $# -ne 1 ]; then - echo "Usage: cdgitpath path_key" >&2 - return 1 - fi - - path_key="$1" - if [ -z "$path_key" ]; then - echo "Usage: cdgitpath path_key" >&2 - return 1 - fi - - path_url="`git config --get --path $path_key`" - if echo "$path_url" | grep -q '^file:/'; then - path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`" - fi - cd "$path_url" - } - # chdir to a remote's directory (if the remote is on the local FS) cdremote() { if [ $# -gt 1 ]; then diff --git a/.shellrc b/.shellrc index 78beaf7..b06ba8b 100644 --- a/.shellrc +++ b/.shellrc @@ -52,6 +52,28 @@ if [ -n "$STY" -a "$WINDOW" != 0 ]; then unset MAILCHECK fi +if test -x /usr/bin/git >/dev/null 2>&1; then + # chdir to a directory + cdgitpath() { + if [ $# -ne 1 ]; then + echo "Usage: cdgitpath path_key" >&2 + return 1 + fi + + path_key="$1" + if [ -z "$path_key" ]; then + echo "Usage: cdgitpath path_key" >&2 + return 1 + fi + + path_url="`git config --get --path $path_key`" + if echo "$path_url" | grep -q '^file:/'; then + path_url="`echo \"$path_url\" | sed 's@^file:/\+@/@'`" + fi + cd "$path_url" + } +fi + include() { cfg="$1" shift -- 2.39.5