Last active
August 29, 2015 13:59
-
-
Save kgadek/10558243 to your computer and use it in GitHub Desktop.
Shell script to start working on exercism.io tasks, customised for my (Haskell) needs.
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
exercism-workon() { | |
cd "$HOME/exercism.io/haskell/$1" | |
MODULE=$(runhaskell "$1_test.hs" 2>&1 | awk '/Could not find module/ {print $5}' | sed "s/[\`']//g") | |
if [ ! -z $MODULE ]; then | |
touch $MODULE; | |
else | |
MODULE=$(ls *.hs | grep -v _test.hs); | |
fi | |
if [ ! -f Guardfile ]; then cat > Guardfile <<EOF | |
# vim: set syntax=ruby | |
guard :shell do | |
watch /(.*).hs$/ do |m| | |
puts "-[ Testing #{m[0]} ]-----------------------------" | |
\`runhaskell $1_test.hs\` | |
end | |
end | |
EOF | |
fi | |
tmux new-session -d "vim $MODULE -c \"vsplit README.md\" -c \"split $1_test.hs\"" | |
tmux split-window -h -l 60 | |
tmux split-window -v ghci | |
tmux split-window -v "guard start" | |
tmux attach-session -d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment