DISCLOSURE: LLM-GENERATED TEXT
Problem
time re-joins its arguments with single spaces and re-tokenizes, so
a quoted argument is destroyed. time set-variable greet "two words"
re-enters CommandShell.RunCommand as three tokens and is rejected:
set-variable requires exactly 2 arguments.
Evidence
Runtime/CommandTerminal/Backend/BuiltinCommands.cs:375 -
shell.RunCommand(JoinArguments(args)).
Runtime/CommandTerminal/Backend/BuiltinCommands.cs:636 -
JoinArguments emits args[i].contents joined with ' ', dropping
CommandArg.startQuote / endQuote.
Runtime/CommandTerminal/Backend/CommandShell.cs:974 - the joined
string goes back through CommandTokenizer.Tokenize.
BuiltinCommands.cs:514 - set-variable is
MinArgCount = 2, MaxArgCount = 2, so the extra token is a hard
error, not a silently wrong value.
time help works, and only because help takes no arguments.
Why it is not one line
log-terminal and log use the same JoinArguments, and there the
developer wants the flattening: log "a b" should print a b, not
"a b". So the quoting has to be conditional on the caller, which
means either a second join method or a flag on the existing one.
The better long-term shape is for time not to re-tokenize at all - it
already has the parsed CommandArg[] and throws it away. That needs a
CommandShell entry point that takes pre-parsed arguments, which is a
larger change; decide which you want.
The same care applies to the quoting style. CommandTokenizer accepts
both "..." and '...', and escapes need to match what the tokenizer
unescapes, so the quoting and the escaping belong next to each other
rather than duplicated in a command handler.
Acceptance
time <anything the console can run without time>` produces the same
result, error messages included, and the same timing line.
DISCLOSURE: LLM-GENERATED TEXT
Problem
timere-joins its arguments with single spaces and re-tokenizes, soa quoted argument is destroyed.
time set-variable greet "two words"re-enters
CommandShell.RunCommandas three tokens and is rejected:set-variable requires exactly 2 arguments.Evidence
Runtime/CommandTerminal/Backend/BuiltinCommands.cs:375-shell.RunCommand(JoinArguments(args)).Runtime/CommandTerminal/Backend/BuiltinCommands.cs:636-JoinArgumentsemitsargs[i].contentsjoined with' ', droppingCommandArg.startQuote/endQuote.Runtime/CommandTerminal/Backend/CommandShell.cs:974- the joinedstring goes back through
CommandTokenizer.Tokenize.BuiltinCommands.cs:514-set-variableisMinArgCount = 2, MaxArgCount = 2, so the extra token is a harderror, not a silently wrong value.
time helpworks, and only becausehelptakes no arguments.Why it is not one line
log-terminalandloguse the sameJoinArguments, and there thedeveloper wants the flattening:
log "a b"should printa b, not"a b". So the quoting has to be conditional on the caller, whichmeans either a second join method or a flag on the existing one.
The better long-term shape is for
timenot to re-tokenize at all - italready has the parsed
CommandArg[]and throws it away. That needs aCommandShellentry point that takes pre-parsed arguments, which is alarger change; decide which you want.
The same care applies to the quoting style.
CommandTokenizeracceptsboth
"..."and'...', and escapes need to match what the tokenizerunescapes, so the quoting and the escaping belong next to each other
rather than duplicated in a command handler.
Acceptance
time <anything the console can run withouttime>` produces the sameresult, error messages included, and the same timing line.