refs #4121 make sure to execute a command only if in cli mode