File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ generate_custom_props_file () {
4+
5+ while getopts " :ho:r:n:" opt; do
6+ case $opt in
7+ o) ORG=" $OPTARG " ;;
8+ n) NAME=" $OPTARG " ;;
9+ h) echo " Usage: generate_custom_props_file [-h] -o ORG [-n FILENAME]" ; return 0 ;;
10+ \? ) echo " Invalid option: -$OPTARG " >&2 ; return 1 ;;
11+ :) echo " Option -$OPTARG requires an argument." >&2 ; return 2;;
12+ esac
13+ done
14+
15+ if [[ -z " ${ORG} " ]]; then
16+ echo " Error: Organization must be specified." >&2
17+ return 3
18+ fi
19+
20+ NAME=${NAME:- " custom_props.json" }
21+
22+ echo " {" > " ${NAME} "
23+ echo " \" properties\" :" >> " ${NAME} "
24+ gh api /orgs/" ${ORG} " /properties/schema | jq -r ' del(.[]|.["url","source_type"])' >> " ${NAME} "
25+ echo " }" >> " ${NAME} "
26+
27+ cat " ${NAME} " | jq . > custom_props.json.tmp
28+ mv custom_props.json.tmp " ${NAME} "
29+ }
30+
31+ generate_custom_props_file " $@ "
32+
You can’t perform that action at this time.
0 commit comments