Skip to content

Instantly share code, notes, and snippets.

@kgadek
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgadek/10558243 to your computer and use it in GitHub Desktop.
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.
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