Refactor: CTS: Add a function for building cmd strings to cts-exec.
This centralizes the horrible string subsitution and concatenation in
one function, instead of spreading it across a couple dozen horrible
lines. I think this is easier to follow.