Commit e3a3b101 authored by Aral Balkan's avatar Aral Balkan

Updated better/stat so that it doesn’t display errors when you’re logged out....

Updated better/stat so that it doesn’t display errors when you’re logged out. Also, it displays none when there are no active branches or merge requests.
parent 9888c0b8
Pipeline #486 skipped
......@@ -78,6 +78,13 @@ listOpenMergeRequests(){
openMergeRequests=$(curl --silent -H "PRIVATE-TOKEN: ${privateToken}" https://source.ind.ie/api/v3/projects/$contentRepositoryID/merge_requests\?state\=opened | $private/lib/jq --raw-output '.[] | " · \(.title)\n\n · Status: \(.merge_status).\n · Opened by \(.author.name) for \(.assignee.name).\n · Request: https://source.ind.ie/better/content/merge_requests/\(.iid)\n · Compare: https://source.ind.ie/better/content/compare/master...\(.source_branch)\n · Issue: https://\(.source_branch)\n"')
if [ -z "$openMergeRequests" ]; then
# No open merge requests.
echo " · None."
return 0
fi
echo "$openMergeRequests"
}
......@@ -89,6 +96,13 @@ listContentUnderActiveDevelopment(){
branchesClean="${branchesRaw//\\n/}"
remoteBranches=$(echo "$branchesClean" | $private/lib/jq --raw-output '.[] | select(.name != "master")')
if [ -z "$remoteBranches" ]; then
# No remote branches
echo " · None."
return 0
fi
remoteBranchNames=$(echo "$remoteBranches" | $private/lib/jq --raw-output '.name')
remoteBranchesList=$(echo "$remoteBranches" | $private/lib/jq --raw-output '"https://\(.name) committed by \(.commit.author_name) (\(.commit.author_email));"')
......@@ -135,6 +149,8 @@ loginStatus(){
echo " ✓ Logged in as ${personName} ($personEmail)."
else
echo " ✕ Not logged in (use better/log-in <privateToken> to log in)."
echo "\nExiting.\n"
exit 0
fi
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment