Commit 68270a4
committed
feat(tools/shellfmt): accept positional file args for scoped format
When called without arguments, lib/tools/shellfmt.sh keeps its current
behaviour — aggregate every .sh/.conf/.inc/.csc/.tvb under compile.sh,
config/boards, config/sources, lib, and extensions and shfmt -w the
lot (CI-style mass-format).
When called with positional file arguments, only those files are
formatted, filtered against the same extension allowlist so a stray
.py / .md / .yml doesn't sneak through. .editorconfig still drives the
actual rules — shfmt picks it up regardless.
This lets editor-driven workflows (post-edit hooks, agent helpers)
scope the format to the file the user just touched without dragging
the whole tree into the next commit. Previously the wrapper silently
ignored file arguments and reformatted everything.
Verified:
- bash lib/tools/shellfmt.sh → full-tree run as before
- bash lib/tools/shellfmt.sh extensions/apa.sh → only apa.sh formatted
- bash lib/tools/shellfmt.sh foo.py extensions/apa.sh
→ .py skipped (unsupported
extension), apa.sh
formatted.1 parent e8b4906 commit 68270a4
1 file changed
Lines changed: 51 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
67 | 83 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
75 | 119 | | |
76 | 120 | | |
77 | 121 | | |
| |||
0 commit comments