Repository navigation
Commit 4ecd2df
committed
fix(commands): preserve ShorthandDeprecated in flag clones and dedupe via helper
Address review feedback from gemini-code-assist on pkg/commands/talosctl_wrapper.go:121:
the manual pflag.Flag clone used for the -f -> -F shorthand rename
was missing the ShorthandDeprecated field. Without it, an upstream
flag that marks its short form as deprecated would have that
deprecation lost on the wrapped clone, and pflag's MarkShorthandDeprecated
check (flag.go:719) would re-emit the shorthand in help output.
Extract a renameFlagShorthand helper that mirrors every pflag.Flag
metadata field, and use it from both the local-flag and
persistent-flag copy loops. Value is intentionally shared (not
deep-copied) — the parser must write to upstream's variable so
the wrapped RunE (assigned from upstream) can still read its own
state via cmd.Flags().Changed/.Value lookups against the wrapped
command instance cobra passes at runtime.
Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>1 parent c2f3017 commit 4ecd2df
1 file changed
Lines changed: 26 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 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 | + | |
95 | 119 | | |
96 | 120 | | |
97 | 121 | | |
| |||
107 | 131 | | |
108 | 132 | | |
109 | 133 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 134 | + | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
| |||
159 | 171 | | |
160 | 172 | | |
161 | 173 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 174 | + | |
176 | 175 | | |
177 | 176 | | |
178 | 177 | | |
| |||
0 commit comments