Automating Terminal Interactions with Templates