function Util.MakeListableType(J,p)local A={Listable=true,Transform=J.Transform,Validate=J.Validate;Autocomplete=J.Autocomplete;Default=J.Default,Parse=function(...)return{J.Parse(...)}end}if p then for J,p in pairs(p)do A[J]=p end end return A end local function J(J)return J:gsub("\092\037\036","\095\095\095\033\067\077\068\082\095\068\079\076\076\065\082\033\095\095\095")end local function p(J)return J:gsub("\095\095\095\033\067\077\068\082\095\068\079\076\076\065\082\033\095\095\095","\036")end function Util.RunCommandString(J,p)p=Util.ParseEscapeSequences(p)p=Util.EncodeEscapedOperators(p)local A=p:split("\038\038")local G=""for p,W in ipairs(A)do local Q=G:gsub("\037\036","\092\120\050\052")W=W:gsub("\124\124",G:find("\037\115")and("\037\113"):format(Q)or Q)G=tostring(J:EvaluateAndRun(Util.RunEmbeddedCommands(J,W)))if p==#A then return G end end end

function Util.MakeListableType(type, override)
	local listableType = {
		Listable = true,
		Transform = type.Transform,
		Validate = type.Validate,
		Autocomplete = type.Autocomplete,
		Default = type.Default,
		Parse = function(...)
			return {type.Parse(...)}
		end
	}

	if override then
		for key, value in pairs(override) do
			listableType[key] = value
		end
	end

	return listableType
end

local function encodeCommandEscape(text)
	return (text:gsub("\\%$", "___!CMDR_DOLLAR!___"))
end

local function decodeCommandEscape(text)
	return (text:gsub("___!CMDR_DOLLAR!___", "$"))
end

function Util.RunCommandString(dispatcher, commandString)
	commandString = Util.ParseEscapeSequences(commandString)
	commandString = Util.EncodeEscapedOperators(commandString)

	local commands = commandString:split("&&")

	local output = ""
	for i, command in ipairs(commands) do
		local outputEncoded = output:gsub("%$", "\\x24")
		command = command:gsub("||", output:find("%s") and ("%q"):format(outputEncoded) or outputEncoded)

		output = tostring(
			dispatcher:EvaluateAndRun(
				(
					Util.RunEmbeddedCommands(dispatcher, command)
				)
			)
		)


		if i == #commands then
			return output
		end
	end
end
