Skip to content

Instantly share code, notes, and snippets.

@svx
Last active May 26, 2016 11:19
Show Gist options
  • Select an option

  • Save svx/45d6a801c3bd21630356 to your computer and use it in GitHub Desktop.

Select an option

Save svx/45d6a801c3bd21630356 to your computer and use it in GitHub Desktop.
#!/bin/bash
# We like colors
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
yellow=`tput setaf 3`
doctest_update() {
docker pull quay.io/tiramisu/mr.docs
}
doctest() {
if [[ $@ ]]; then
: #Do nothing
else
clear
echo "${red}Missing argument${reset}"
echo "Use""${green} doctest"${reset}"${yellow} html linkcheck spellcheck${reset}"
kill -INT $$;
fi
if [ -d "docs/_build" ]; then
sudo rm -rf docs/_build
fi
docker run --privileged=true -it --rm \
-v ${PWD}/docs:/build/docs:rw \
--name docs-test \
quay.io/tiramisu/mr.docs "$1"
sudo chown -R $USER:$USER docs
}
_doctest() {
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="html linkcheck spellcheck"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -F _doctest doctest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment