fix(set): support bundled -o in short-flag clusters (set -euo pipefail) (#261)
* fix(set): support bundled -o in short-flag clusters (set -euo pipefail) `set -euo pipefail` previously failed with `bash: set: -o: invalid option`: the cluster parser treated every character after `-` as an independent short flag and has no `o` flag, so `-o` was only honored as its own token. Match bash: an `o` inside a cluster consumes the next word as its long-option name, and the remaining characters keep being parsed as short flags. `set -euo pipefail` == `set -e -u -o pipefail`, `set -oe pipefail` enables both pipefail and errexit, trailing words become positional parameters, `+`-clusters disable, and an invalid bundled name still reports `invalid option name`. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(set): apply remaining cluster flags after a no-name bundled -o A bundled `o` with no following option-name word (e.g. `set -oe`) was returning early after printing the option listing, abandoning the rest of the short-flag cluster. Real bash still applies every flag — `set -oe` enables errexit and prints the listing — so defer the listing and keep processing the remaining flags, flushing the accumulated listing at the end. Addresses Vercel Agent Review feedback on the bundled-`-o` change. Co-authored-by: Cursor <cursoragent@cursor.com> * test(set): cover multiple bundled -o consuming successive words Adds a regression test for `set -oo pipefail errexit`, addressing Copilot's suggestion to cover the multi-`o` edge case alongside the no-name listing fallback tests. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(set): keep processing tokens after a no-name -o/+o listing A standalone `-o`/`+o` with no option-name word (e.g. `set -o -x`) returned early after printing the listing, dropping any following tokens. bash prints the listing and continues — `set -o -x` lists options and then enables xtrace — so defer the standalone listing the same way as the bundled case and flush it at the end. Clarifies that an option-like token (`-x`) is not consumed as the `-o` name, and adds a `set -o -x` regression test. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
M
Mikhail Chernetsov committed
c9904dea24ad2aa847749ee6289239c2a2c651fc
Parent: dfc5d65
Committed by GitHub <noreply@github.com>
on 6/3/2026, 11:54:11 PM