Skip to content

Commit

Permalink
Test for user file before assuming org or team
Browse files Browse the repository at this point in the history
Fixing a bug where the file path passed is in a different directory, causing gh-montage to incorrectly look for a github org team.
  • Loading branch information
andyfeller committed Nov 1, 2023
1 parent cd3db2b commit 9349136
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gh-montage
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ shift "$((OPTIND-1))"

if [ -z "$1" ]; then
die "Must provide organization or organization/team"
elif [[ "$1" == *"/"* ]]; then
ORGANIZATION=$(echo $1 | cut -d '/' -f 1)
TEAM=$(echo $1 | cut -d '/' -f 2)

if [ -z "${OUTPUTFILE}" ]; then
OUTPUTFILE="$ORGANIZATION-$TEAM-$AVATARPIXELS.png"
fi
elif [ -f "$1" ]; then
# If argument is valid file, read usernames from file
USERS_FILE="$1"
Expand All @@ -107,6 +100,13 @@ elif [ -f "$1" ]; then
if [ -z "${OUTPUTFILE}" ]; then
OUTPUTFILE="$(basename ""$USERS_FILE"").png"
fi
elif [[ "$1" == *"/"* ]]; then
ORGANIZATION=$(echo $1 | cut -d '/' -f 1)
TEAM=$(echo $1 | cut -d '/' -f 2)

if [ -z "${OUTPUTFILE}" ]; then
OUTPUTFILE="$ORGANIZATION-$TEAM-$AVATARPIXELS.png"
fi
else
ORGANIZATION="$1"

Expand Down

0 comments on commit 9349136

Please sign in to comment.