Skip to content

Tell the user when there are no files to pick instead of printing the picker's usage - #14538

Open
omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-7114
Open

omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-7114

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

On a fresh install ~/Pictures and ~/Videos exist and are empty, so omarchy transcode printed Usage: 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-file piped its find results straight into omarchy-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 in omarchy-menu-file first, 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" in omarchy-games-retro-install, the helper's other caller, which now gets the notification for an empty ~/Games/roms and still exits 0 through its || exit 0. The fix sits in omarchy-menu-file rather than omarchy-menu-select because 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 only find's: an unreadable subdirectory makes find fail, which under pipefail made the helper exit 1 even after the user picked a file, so transcode stopped there. sort and cut failures still fail the helper.

test/shell.d/menu-file-test.sh runs the real omarchy-transcode, omarchy-menu-file and omarchy-menu-select against 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 on quattro (902fd8a) with the usage message and passes here, alongside ./test/cli and the menu shell tests. The diagnosis and the fix were reviewed by Codex Medium as a second opinion; its two findings, an if/else the style guide asks for and narrowing the ignored status to find alone, are in this change.

Fixes #7114

… 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]>
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how the file picker handles empty results.

The PR appears safe to merge.

What we checked:

  • Notification text becomes a selection: The call does not request a notification ID, so omarchy-notification-send sends stdout to /dev/null.
  • Other file-list failures disappear: Only find uses || true. With set -euo pipefail, a failed sort or cut still makes the assignment fail and stops the helper.

Summary

omarchy-menu-file now tells users when no matching files exist instead of opening the picker with an empty list.

  • The notification names the searched paths.
  • Files found before an unreadable subdirectory remain selectable.
  • New tests cover empty folders, newest-first ordering, and unreadable subdirectories.

Reviews (1) · Last reviewed commit: "Tell the user when there are no files to..." · Reviewed by Greptile

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

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 omarchy-menu-select / omarchy-transcode, while this keeps the fix in omarchy-menu-file. It probably makes sense to pick one approach and close the other.

@omarchybot omarchybot added the bug Something isn't working label Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator Author

This competes with #7320, which is older, fixes the same bug (#7114), and already carries verified and ready. #7320 should be the one that lands, and this one should not be brought to ready beside it.

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 omarchy-menu-select printing its usage text for an empty piped list. #7320 fixes that in the helper itself, so the other callers that pipe into it are covered as well.

The one thing this pull request adds is in test/shell.d/menu-file-test.sh: a test that a non-empty search still reaches the picker newest first, filtered by extension, and returns the pick. #7320 rewrites that path and has no test for it, so this test has been handed to #7320's next review to fold in.

How this was checked: both diffs were read against quattro and its docs/i18n.md. Nothing was run on a worker, because a fix that should not land is not worth verifying. Codex Medium got both pull requests without my answer and also chose #7320. On that choice and the i18n defect it agreed, but its independence is not guaranteed. It contributed the unreadable-root case and the omarchy-menu-select point, both of which were checked against the source, and it named the ordering test as the only thing worth folding in. The classification as a bug was agreed by both models.

Next step for the maintainer: decide between the two. The recommendation is to merge #7320 and close this one.

omarchybot added a commit to wbarakat/omarchy that referenced this pull request Oct 16, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy transcode fails with an internal usage message when ~/Pictures and ~/Videos are empty

2 participants