Files
repo-tools/init-repo-tools
2024-06-17 17:43:36 +10:00

17 lines
501 B
Bash
Executable File

#!/usr/bin/env bash
#
# Call this your shell config, e.g. ~/.zshrc, and eval the results, e.g.:
#
# eval "$(/path/to/this/repo/init-repo-tools)"
#
# Bash scripts can't change the working directory of their callers. This is
# right and proper, but changing working directory is `repo`'s entire purpose,
# so we need to work around that restriction.
#
cat <<-EOS
repo () {
r=\$($(dirname $(realpath ${BASH_SOURCE[0]}))/repo \$@)
[[ "\$r" != "." ]] && [[ "\$r" != "\$(pwd)/" ]] && cd \$r
}
EOS