Repository navigation
fix(commands): return error on invalid alignment in fill command - #19361
Conversation
|
looks like your backslashes |
im fixing it rn thank you |
There was a problem hiding this comment.
Review overview
🟡 Changes recommended
The error itself works as described. The notes are about where the new tests live, what they check, and keeping the help text and completions in line with the new message.
Findings: 0
Open (5)
Notes from my clanker, checked on 038c956. Built the branch and ran fill -a with invalid, '', centre, LEFT, MiddleRight, a variable and a list input; cargo fmt --all -- --check and cargo test -p nu-command --test tests -- fill pass.
|
when you're finished, please respond on each review comment to make sure we didn't miss anything |
There was a problem hiding this comment.
Review overview
🟡 Changes recommended
All 5 threads from the first review are fixed on 80c13a7, and I've resolved them. One new Low: the PR body still describes the first commit.
Findings: 0
Notes from my clanker, checked on 80c13a7. Built the branch and ran cargo test -p nu-command --test tests -- commands::fill (4 passed), the fill test_examples (1 passed), cargo fmt --all --check and typos, and ran each alignment name and invalid value on the branch binary and on main at 7a49c10. I didn't run clippy locally; CI's clippy step passed on this head.
|
The PR description has been updated with the corrected error output ( |
|
Thanks |



Description
Previously,
fillsilently accepted unknown values for the--alignment(-a) option and defaulted toLeft. An explicit// TODO: This should probably be an errorcomment was present in theFromValueimplementation forFillAlignment.This PR changes
FillAlignment::from_valueto returnShellError::InvalidValuewhen an invalid alignment string is supplied, informing the user about the expected valid choices (left,right,center/middle,centerright/middleright).User-facing changes (Release notes)
fill --alignmentnow errors on an unknown alignment instead of silently left-aligning; valid values areleft,right,center/middleandcenterright/middleright.Tests + Formatting
crates/nu-command/tests/commands/fill.rsverifying both valid alignments and the error raised on invalid/empty input.cargo test -p nu-command --test tests -- commands::fill(4 passed).cargo fmt --all -- --check.