Repository navigation
feat(cli): explain --env when a space in the path caused the failure - #1248
Merged
Merged
Conversation
-e/--env/--boot takes "file arg1 arg2" and splits on the first space, which is deliberate and makes a path containing a space unusable. The message then named a truncated path the user never typed -- `--env "my boot.sh"` reported 'my' -- so checking that the file exists only confirms it does, and the error reads as simply wrong. Keep the split, explain it exactly when it is the cause: when the value holds a space and the whole value is readable, say so and name BASHUNIT_BOOTSTRAP, which is not split. Verified that route takes a spaced path before recommending it. test.sh and bench.sh carried identical copies of the parse and the message, so the reporter lives in validate.sh with the other shared parser validation and both call it. Three guards keep the explanation from becoming noise: a missing file with no space stays terse, `--env "boot.sh arg"` still passes arguments, and the env var still loads. Closes #1247
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤔 Background
Related #1247
-e/--env/--boottakes"file arg1 arg2"and splits on the first space — deliberate, and it makes a path containing a space unusable. The message then named a truncated path the user never typed:Checking whether
my boot.shexists only confirms that it does, so the error reads as simply wrong.💡 Changes
BASHUNIT_BOOTSTRAP, which is not splitvalidate.shwith the other shared parser validation:test.shandbench.shcarried identical copies of the parse and the message, and both now emit the explanationThree guards keep it from becoming noise: a genuinely missing file with no space stays terse,
--env "boot.sh arg"still passes arguments, and the env var still loads. All three passed before the fix — only the diagnostic was red.