Skip to content

Mention nullglob exceptions in failglob error message - #3101

Closed
cben wants to merge 1 commit into
fish-shell:masterfrom
cben:nullglob-tip
Closed

cben wants to merge 1 commit into
fish-shell:masterfrom
cben:nullglob-tip

Conversation

@cben

@cben cben commented Jun 1, 2016

Copy link
Copy Markdown
Contributor

I was trying rm -i **.orig **\# **/*\~ which errored with
No matches for wildcard “**.orig”., while I wanted it to proceed
with whatever did match - and had no idea how to achieve that.

  • Googling "fish zero matches" and similar leads to multiple github
    discussions, not all related. Eventually I found the long Failed wildcards still execute #2394
    and learnt the terms "failglob" / "nullglob" and the set, count
    and for exceptions.
  • The 2.3 documentation and release notes do mention these exceptions,
    but it hadn't occurred to me to look there, or what portion to read
    (well duh the section on globbing, but I didn't expect the rule has
    exceptions).

This PR mentions the 3 exceptions briefly in the error message itself:

"No matches for wildcard '**.orig'.  (Tip: empty matches are allowed in 'set', 'count', 'for'.)

I'm afraid my wording is unclear but at least it gives some lead?
I'm strongly tempted to instead give a concrete example:

"No matches for wildcard '**.orig'.  (Tip: 'set matches **.orig' would succeed.)`

since if you know that, you can achieve nullglob anywhere.
But I'm concerned that mentioning only one way would lead to people
assuming that's all there is and never learning about count, for.

@faho

faho commented Jun 1, 2016

Copy link
Copy Markdown
Member

This message looks good to me, but the output in tests/test5.err also needs to be adjusted.

@krader1961

Copy link
Copy Markdown
Contributor

I fixed the unit test and merged as commit 63a851c.

@anordal anordal mentioned this pull request Jul 3, 2017
1 of 3 tasks
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants