Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add type of the object to the index file of che-plugin-registry (#6)
Browse files Browse the repository at this point in the history
Add type of the object to the index file of che-plugin-registry (#6)
  • Loading branch information
skabashnyuk authored Aug 16, 2018
1 parent db1e1a4 commit 22c2762
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,27 @@ echo "["
## now loop through meta files
for i in "${arr[@]}"
do
IFS='/' segments=($i)
if [ "$FIRST_LINE" = true ] ; then
echo \{\"name\":\"${segments[2]}\",\"version\":\"${segments[3]}\"\}
echo "{"
FIRST_LINE=false
else
echo \,\{\"name\":\"${segments[2]}\",\"version\":\"${segments[3]}\"\}
echo ",{"
fi

# 1. read meta.yaml to stio
cat $i| \
# 2. filter lines with name,version,type
grep -e name -e version -e type |\
# 3. Replace ` :` with `":"`
sed 's/: /\":"/g' |\
# 4. Append `",` to the end of each line
sed 's/$/\",/g' |\
# 5. Append `"` at the beginning of each line
sed 's/^/\"/g' |\
# 6. Remove all new lines
tr -d '\n' |\
# 7. Remove last ','
sed 's/,$//g'
echo "}"
done
echo "]"

0 comments on commit 22c2762

Please sign in to comment.