Add in asseturls to options for git-list..
This commit is contained in:
parent
99be082770
commit
e2b9906429
@ -166,6 +166,7 @@ optional: (in any order)
|
||||
* \<allreleases\> Show all releases
|
||||
* \<cloneurl\> Show the url to use to clone this repo
|
||||
* \<zipurl\> Show the url to get the zipped contents of the repo
|
||||
* \<asseturls\> Show the URLs of the assets associated with the release
|
||||
|
||||
Does:
|
||||
|
||||
|
@ -8,7 +8,7 @@ if [ ! -e $inifilename ] ; then
|
||||
# Not here, look at system default
|
||||
if [ ! -e /etc/smegit.ini ] ; then
|
||||
echo "No ini file found $inifilename or /etc/smegit.ini"
|
||||
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl]"
|
||||
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl] [asseturls]"
|
||||
exit 1
|
||||
else
|
||||
inifilename="/etc/smegit.ini"
|
||||
@ -62,6 +62,8 @@ for param in $2 $3 $4 $5 $6 $7 $8 $9 $10; do
|
||||
SHOWZIPURL=true ;;
|
||||
id )
|
||||
SHOWID=true ;;
|
||||
asseturls )
|
||||
SHOWASSETURLS=true ;;
|
||||
* )
|
||||
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||
esac
|
||||
@ -71,7 +73,7 @@ for param in $2 $3 $4 $5 $6 $7 $8 $9 $10; do
|
||||
done
|
||||
|
||||
if [[ -z $1 ]] ; then
|
||||
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl]"
|
||||
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl] [asseturls]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -113,14 +115,18 @@ for item in $REPO_LIST ; do
|
||||
ID=$(echo $RESPONSE | jq -r '.[0].id')
|
||||
PRE=$(echo $RESPONSE | jq -r '.[0].prerelease')
|
||||
DRAFT=$(echo $RESPONSE | jq -r '.[0].draft')
|
||||
# Get assets - json for any files uploaded
|
||||
ASSETS=$(echo $RESPONSE | jq -r '.[0].assets')
|
||||
# Number of assets
|
||||
NUMASSETS=$(echo $ASSETS | jq length)
|
||||
if [ $DEBUG ]; then echo "Assets:$NUMASSETS"; fi
|
||||
if [ $PRE = "true" ] ; then PRE="pre";
|
||||
else PRE=""; fi
|
||||
if [ $DRAFT = "true" ] ; then DRAFT="draft";
|
||||
else DRAFT=""; fi
|
||||
if [ $DEBUG ] ; then echo "pre:$PRE Draft:$DRAFT"; fi
|
||||
if [ $DEBUG ] ; then echo $REL; fi
|
||||
if [ "$REL" ] ; then line="$line $REL $ID $PRE $DRAFT";
|
||||
else line="$line\tnone";fi
|
||||
if [ "$REL" ] ; then line="$line $REL $ID $PRE $DRAFT $NUMASSETS"; fi
|
||||
if [ $SHOWCLONEURL ] ; then
|
||||
URL=$(echo $RESPONSE | jq -r '.[0].url')
|
||||
if [ "$URL" ] ; then line="$line $URL"; fi
|
||||
@ -129,6 +135,13 @@ for item in $REPO_LIST ; do
|
||||
URL=$(echo $RESPONSE | jq -r '.[0].zipball_url')
|
||||
if [ "$URL" ] ; then line="$line $URL"; fi
|
||||
fi
|
||||
if [[ $NUMASSETS -gt 0 && $SHOWASSETURLS ]]; then
|
||||
ASSETURLS=$(echo $ASSETS | jq 'map("\(.name):\(.browser_download_url).")')
|
||||
if [ $DEBUG ]; then echo "$ASSETURLS"; fi
|
||||
# Turn the json into a list one on each line
|
||||
ASSETURLS=$(echo $ASSETURLS | sed 's/\[//' | sed 's/\]//' | sed 's/,/\\n/g' | sed 's/\"//g')
|
||||
line="$line\n$ASSETURLS";
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo -e $line;
|
||||
|
Loading…
Reference in New Issue
Block a user