merge Environment#build_command and #expand_varref