File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,24 @@ Per-command handlers add domain-specific placeholders beyond the generic
7272rules above. For example, ` curl -H ` collapses to ` <header> ` , ` grep ` 's
7373first positional becomes ` <pattern> ` , and ` jq ` 's filter becomes ` <filter> ` .
7474
75+ ### Compound commands
76+
77+ Shell compound commands (` for ` , ` while ` , ` until ` , ` if ` ) are recognized as
78+ single structural units. Internal separators (` ; ` , ` && ` , ` | ` ) inside the
79+ compound don't split it apart, and the body is recursively normalized:
80+
81+ ```
82+ $ shellshape "for cmd in doctor test show stats; do python3 app \$cmd --help; done"
83+ for cmd in <val>+ ; do python3 app <arg>+ ; done
84+
85+ $ shellshape "if test -f /tmp/config.yml; then cat /tmp/config.yml; else echo missing; fi"
86+ if test -f <path> ; then cat <path> ; else echo <str> ; fi
87+ ```
88+
89+ For-in iteration values are collapsed to ` <val>+ ` . C-style ` for ((...)) ` loop
90+ expressions are collapsed to ` ((<expr>)) ` . Nested compounds are handled
91+ correctly.
92+
7593### Subshell safety
7694
7795Subshell expressions like ` $(...) ` are recursively normalized but never
You can’t perform that action at this time.
0 commit comments