Skip to content

feat(cli): explain --env when a space in the path caused the failure - #1248

Merged
Chemaclass merged 1 commit into
mainfrom
feat/bootstrap-space-diagnostic
Aug 14, 2026
Merged

Chemaclass merged 1 commit into
mainfrom
feat/bootstrap-space-diagnostic

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1247

-e/--env/--boot takes "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:

$ bashunit --env "my boot.sh" t_test.sh
Error: cannot read the bootstrap file: 'my'.

Checking whether my boot.sh exists only confirms that it does, so the error reads as simply wrong.

💡 Changes

Three 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.

-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
@Chemaclass Chemaclass added the enhancement New feature or request label Aug 14, 2026
@Chemaclass Chemaclass self-assigned this Aug 14, 2026
@Chemaclass
Chemaclass merged commit d0f281e into main Aug 14, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the feat/bootstrap-space-diagnostic branch August 14, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant