Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in path logic gef-extras.sh #872

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 23 additions & 10 deletions scripts/gef-extras.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@
#
set -e

usage() { echo "Usage: $0 [-b <main|dev>] [-p <path_to_install>]" 1>&2; exit 1; }
hugsy marked this conversation as resolved.
Show resolved Hide resolved

branch="main"
if [ "$1" = "dev" ]; then
branch="dev"
echo "set branch to dev"
fi
while getopts ":b:p:" o; do
case "${o}" in
b)
branch=${OPTARG}
;;
p)
path=${OPTARG}
;;
*)
usage
;;
esac
done

if [ $# -ge 1 ]; then
DIR="$(realpath "$1")/gef-extras"
test -d "${DIR}" || exit 1
elif [ -d "${HOME}/.config" ]; then
DIR="${HOME}/.config/gef-extras"
if [ -z "$path" ]; then
if [ -d "${HOME}/.config" ]; then
DIR="${HOME}/.config/gef-extras"
else
DIR="${HOME}/.gef-extras"
fi
else
DIR="${HOME}/.gef-extras"
DIR="$(realpath "$path")/gef-extras"
test -d "${DIR}" || exit 1
fi

git clone --branch ${branch} https://github.com/hugsy/gef-extras.git "${DIR}"
Expand Down