Allow UCM commands to have “unprocessed” arguments #5549
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
There are some commands (like
run
) that don’t want expanded arguments passed to them. E.g.,run main 1
should pass “1” to main, not the numbered result from a previous command.Fixes #2805
Implementation notes
This makes a couple changes. First, it creates a
Parameters
structure that gives a more precise definition of the arguments a command can receive, and eliminates incorrect parameter definitions. It then adds anisStructured
field to theParameterType
(néeArgumentType
) record, which indicates whether arguments to parameters of that type should be parsed & have numbers expanded.One of the complicated bits (as seen in
foldParamsWithM
) is that an “input argument” can be expanded to multiple arguments, and we have to process the arguments left to right, because we don’t know which parameter an argument applies to until after we’ve expanded all the ones ahead of it.Test coverage
This adds a transcript for
run
that shows the new behavior (as best we can without capturingrun
output in transcripts).Loose ends
This is an improved version of the first half of #5480, which also “fixed” #5193. The work here is also progress toward #5193, but the approach in #5480 isn’t great.
The new transcript here also explicitly use
lib.install @unison/base
, despite being in the transcripts-using-base directory, which I would think would make that unnecessary.