Last active
August 31, 2021 12:46
-
-
Save Konfekt/a37bc355c6ed2852cb3f55cad4170c0b to your computer and use it in GitHub Desktop.
add missing Vim help to Vim plug-in repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# description: add missing Vim help to Vim plug-in repos | |
# usage: add-vim-help.sh repos/* | |
# where repos/* are folders containing cloned repos without Vim help files | |
# needs: | |
# - md2vim from https://github.com/FooSoft/md2vim | |
# - hub from https://github.com/github/hub/ to open a Github pull request | |
# Replace github-user-name by your Github user name! | |
USER=github-user-name | |
for d in "$@" | |
do ( | |
# only enter repo if doc missing | |
if [ -d "$d/doc" ]; then | |
continue | |
else | |
cd "$d" || continue | |
fi | |
echo "adding Vim help file to $d..." | |
mkdir doc | |
# add Readme in Markdown if in RST format | |
[ -f README.rst ] && pandoc --from rest --to markdown README.rst --output README.md | |
file="$d".txt | |
# remove vim prefix or suffix from help tags | |
file=${file##vim-} | |
file=${file%%.vim} | |
file=${file%%-vim} | |
# convert help file | |
md2vim README.md "doc/$file" | |
# set as help file | |
echo ' vim:tw=78:ts=8:ft=help:norl:' >> "doc/$file" | |
hub fork | |
git remote rename origin upstream | |
git remote rename "$USER" origin | |
# push | |
git add --all && git commit -m 'add Vim help' && git push | |
# open pull request | |
hub pull-request -p -m 'add Vim help' | |
echo "... done" | |
) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment