From 69ab075c80b3fb06536559e0ce9b6fc0691a96c6 Mon Sep 17 00:00:00 2001 From: Lucas Wilson-Richter Date: Sun, 19 May 2024 22:51:56 +1000 Subject: [PATCH] init: actually work --- init-repo-tools | 15 +++++++++++++++ init.bash | 6 ------ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100755 init-repo-tools delete mode 100644 init.bash diff --git a/init-repo-tools b/init-repo-tools new file mode 100755 index 0000000..062a345 --- /dev/null +++ b/init-repo-tools @@ -0,0 +1,15 @@ +#!/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 () { + cd \$($(dirname $(realpath ${BASH_SOURCE[0]}))/repo \$@) +} +EOS diff --git a/init.bash b/init.bash deleted file mode 100644 index 9bc46e2..0000000 --- a/init.bash +++ /dev/null @@ -1,6 +0,0 @@ -# Source this into your shell config, e.g. ~/.zshrc - -# Bash scripts can't change the working directory of their callers. This is -# right and proper, but we need to work around it in this case. -# -repo () { cd $($(dirname ${BASH_SOURCE[0]})/repo $@) }