Skip to content

Commit

Permalink
Changing the order to check dir for home dir
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada committed Aug 5, 2021
1 parent ee6a36f commit ed0e580
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions gitstart
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ if [ ! "$(command -v jq)" ]; then
fi

############# Main body ############
# don't allow to create a git repo in the ~ (HOME)
if [[ (${dir} = "$HOME") ]]; then
echo "This script doesn't allow to create a git repo in the home directory."
echo "Use another directory."
exit 1
fi

# Directory path. If dir is . then use pwd
if [[ ${dir} = "." ]]; then
Expand All @@ -104,6 +98,13 @@ else
# cd "$dir" || exit
fi

# don't allow to create a git repo in the ~ (HOME)
if [[ (${dir} = "$HOME") ]]; then
echo "This script doesn't allow to create a git repo in the home directory."
echo "Use another directory."
exit 1
fi

gitname() {
printf "Please type your Github username. "
read -r github_username
Expand Down Expand Up @@ -163,9 +164,9 @@ select license in "${lisences[@]}"; do
esac
done

# echo "$dir"
echo "$dir"
cd "$dir" || exit

exit
# creating a remote github repo using gh
printf "Creating a public remote repo..."
gh repo create --confirm --public || {
Expand Down

0 comments on commit ed0e580

Please sign in to comment.