File tree Expand file tree Collapse file tree 1 file changed +34
-2
lines changed
Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change 1- #! /usr/bin/env bash
1+ #! /usr/bin/env bash
22
3- aws codecommit list-repositories --query ' repositories[].repositoryName' --output text | xargs -n1
3+ if [ " $1 " = " --create-repos-md" ]; then
4+ # Create repos.md file with boilerplate text
5+ echo " # AWS CodeCommit Repositories
6+
7+ This document lists the CodeCommit repositories available in the current AWS account and region.
8+
9+ " > REPOS.md
10+
11+ # Get list of repositories
12+ repos=$( aws codecommit list-repositories --query ' repositories[*].repositoryName' --output text)
13+
14+ # Loop through repositories and add details to repos.md
15+ for repo in $repos ; do
16+ # Get repository description
17+ description=$( aws codecommit get-repository --repository-name " $repo " --query ' repositoryMetadata.description' --output text)
18+
19+ # If description is None, set it to "No description available"
20+ if [ " $description " = " None" ]; then
21+ description=" No description available"
22+ fi
23+
24+ # Append repository details to repos.md
25+ echo " ## $repo " >> REPOS.md
26+ echo " " >> REPOS.md
27+ echo " Description: $description " >> REPOS.md
28+ echo " " >> REPOS.md
29+ done
30+
31+ # No output to stdout
32+ else
33+ # Original functionality: list repositories to stdout
34+ aws codecommit list-repositories --query ' repositories[].repositoryName' --output text | xargs -n1
35+ fi
You can’t perform that action at this time.
0 commit comments