Repository navigation
Tell the user when there are no files to pick instead of printing the picker's usage - #14538
omarchybot wants to merge 1 commit into
Conversation
… picker's usage omarchy-menu-file piped its find results straight into omarchy-menu-select, which cannot tell an empty piped list from being called with no options and so printed its usage and exited 1. On a fresh install, with ~/Pictures and ~/Videos empty, that made `omarchy transcode` print an internal usage string, and Transcode from the menu, which has no terminal, did nothing at all. Collect the list first, and when it is empty send a "No files found" notification naming the paths searched and exit 1 without opening the picker. Collecting the list also means find's own status no longer reaches the script's exit: an unreadable subdirectory made find fail, which under pipefail made the helper exit 1 even after a pick, so transcode stopped there. Only find's status is ignored; sort and cut still fail the helper. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
|
Heads up: #7320 ("Give empty menu file searches real feedback instead of a usage error") is still open for the same issue (#7114), and omarchybot reviewed and pushed to it on 09-28. It changes |
|
This competes with #7320, which is older, fixes the same bug (#7114), and already carries Why #7320 and not this one: by default the older fix wins, and this one is not clearly better. It also has two defects that #7320 does not:
It also leaves The one thing this pull request adds is in How this was checked: both diffs were read against Next step for the maintainer: decide between the two. The recommendation is to merge #7320 and close this one. |
The list now reaches omarchy-menu-select as a here-string rather than a pipe, and nothing checked that the rows, their order, the extension filter or the returned pick survived that. Adapted from the test in omacom#14538, which fixes the same bug and was left in favour of this one. Co-Authored-By: Omarchybot <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a fresh install
~/Picturesand~/Videosexist and are empty, soomarchy transcodeprintedUsage: omarchy-menu-select <prompt> [option...] [-- menu args...]and exited 1, and Transcode from the menu, which has no terminal for that message, did nothing at all.omarchy-menu-filepiped itsfindresults straight intoomarchy-menu-select, which reads options from stdin only when it was given none as arguments, and so cannot tell an empty piped list from a call with no options. This collects the list inomarchy-menu-filefirst, and when it is empty sends a "No files found" notification naming the paths searched and exits 1 without opening the picker — the same shape as "No RetroArch cores found" inomarchy-games-retro-install, the helper's other caller, which now gets the notification for an empty~/Games/romsand still exits 0 through its|| exit 0. The fix sits inomarchy-menu-filerather thanomarchy-menu-selectbecause only the former knows an empty list means "no files" and which paths were searched; the generic picker's callers are unchanged.Collecting the list means
find's exit status is now ignored, and onlyfind's: an unreadable subdirectory makesfindfail, which underpipefailmade the helper exit 1 even after the user picked a file, so transcode stopped there.sortandcutfailures still fail the helper.test/shell.d/menu-file-test.shruns the realomarchy-transcode,omarchy-menu-fileandomarchy-menu-selectagainst empty directories with only the notification stubbed, and checks that matching files are still offered newest first and that a pick survives an unreadable subdirectory. On a worker built from the Omarchy ISO it fails onquattro(902fd8a) with the usage message and passes here, alongside./test/cliand the menu shell tests. The diagnosis and the fix were reviewed by Codex Medium as a second opinion; its two findings, anif/elsethe style guide asks for and narrowing the ignored status tofindalone, are in this change.Fixes #7114