Thread (15 messages) flat view 15 messages, 4 authors, 10d ago

Re: [PATCH v2] completion: zsh: support completion after "git -C <path>"

From: Junio C Hamano <hidden>
Date: 2026-08-21 16:42:44

"D. Ben Knoble" [off-list ref] writes:
quoted
[Footnote]

* Look for case_clause in
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
  and read from there.
Oh, thanks! The Bash manual doesn't admit that case in my reading, but
it clearly does in implementation. Oddly, I seem to recall several
years ago that both Bash and ShellCheck would complain about empty
case arms (I got in the habit of writing ": continue" as a bit of a
comment). Anyway, TIL.
I am afraid that the description in POSIX itself contributes heavily
to this common misconception.

Section 2.9.4.3 (Case Conditional Construct)

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_09_04_05

gives a simplified syntax

    The format for the case construct is as follows:

    case word in
        [[(] pattern[ | pattern] ... ) compound-list terminator] ...
        [[(] pattern[ | pattern] ... ) compound-list]
    esac

and I think that is where the most people go to learn what is and
what is not kosher in the standard.  But as you saw, this simplified
"format" contradicts what the actual grammar, described in Section
2.10 (Shell Grammar) has (notably, you can have linebreak, which is
defined to be zero or more NEWLINEs, instead of compound-list
there).

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_10
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help