zeal_tf_aws_docset/cmd.txt

19 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-05-31 13:39:56 +00:00
mkdir -p tf_aws.docset/Contents/Resources/Documents/
2023-05-31 13:48:36 +00:00
# sources
2023-05-31 13:39:56 +00:00
svn export https://github.com/hashicorp/terraform-provider-aws/trunk/website/docs
2023-05-31 13:48:36 +00:00
# metadata
2023-05-31 13:39:56 +00:00
wget https://kapeli.com/resources/Info.plist
sed -i -e 's,nginx,tf_aws,' -e 's,Nginx,TF AWS,' Info.plist
mv Info.plist tf_aws.docset/Contents/
2023-05-31 13:48:36 +00:00
# icon
wget -O tf_aws.docset/icon.png https://registry.terraform.io/images/favicons/favicon-32x32.png
# build content
find docs -type f -print0 | xargs -0 -P 3 -I £ bash convert.sh £ tf_aws.docset/Contents/Resources/Documents/£
# search index
2023-05-31 13:39:56 +00:00
sqlite3 tf_aws.docset/Contents/Resources/docSet.dsidx 'CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);'
sqlite3 tf_aws.docset/Contents/Resources/docSet.dsidx 'CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);'
find docs -type f -print0 | xargs -0 -I £ awk -vOFS="\t" -vf=£ '$1=="page_title:" {$1=""; print substr($0,8,length($0)-8),index(f,"/r/")?"Resource":"Object",substr(f,1,length(f)-9); nextfile}' £ | awk -vOFS="\t" 'NR==1{$1="aws_provider"}{print NR, $0}' > index.tsv
{ echo '.mode tabs' ; echo '.import index.tsv searchIndex' ; } | sqlite3 tf_aws.docset/Contents/Resources/docSet.dsidx
2023-05-31 13:48:36 +00:00
# deploy
2023-05-31 13:39:56 +00:00
mv tf_aws.docset ~/.local/share/Zeal/Zeal/docsets/