Closed zheland closed 1 month ago
Looks great.
Also, if you don't mind, this PR removes the unnecessary expect and unreachable in the moved fragment with a little refactoring.
Loving it :) Can you move it in a separate commit though? First commit - this fix, second commit - smarter selection fix.
Sorry for the strange intermediate push to PR, I don't know how that happened, re-pushed (fixed).
I hope I correctly understood the commit order you meant. First "refactor", second "bug" fix?
Sorry for the strange intermediate push to PR, I don't know how that happened, re-pushed (fixed).
No worries, git does strange things sometimes :)
I hope I correctly understood the commit order you meant.
I imagined the first commit will have only -> !
and -unreachable!("suggest_name exits");
parts, second one - everything else, but what you did seems more correct. CI passes, I'll try to merge/release later today.
When an item is specified in arguments, it is expected that no matter how many items are found, the requested item will be shown. When the
--everything
option is given, it is expected that no matter how many items are found, "everything" will be shown.Currently (without this PR) if there is only one item found, it will always return only this item, regardless of what is requested on the command line.
This PR moves the automatic selection of a single item later, after checking that we have not selected anything (or
--everything
) for display.Also, if you don't mind, this PR removes the unnecessary
expect
andunreachable
in the moved fragment with a little refactoring. I can revert some of the changes if something is not okay or less readable.Example
Current output (without this PR)
Expected (with this PR)
Tests
Checked with example about on linux x86_64 and with
cargo test
.