Repository navigation
Commit 7b8baa0
committed
fix: stop a user bool -h flag from showing help
The help flag now gives up -h to a user flag that claims it, and help
lists -h as that flag. checkHelp still matched the names of the global
HelpFlag though, so a user bool -h flag showed help instead of running
the action:
foo -h # user bool -h flag: help shown, action not run
Keep the help flag that ensureHelp adds and check that one, as
checkVersion does with the version flag. When a command has no help flag
of its own, check a user flag that took its name instead, such as
HelpFlag itself listed in Flags or a help flag added with HideHelp, so
these still show help as before.
With HideHelp and no such flag, checkHelp no longer looks up help and h,
so InvalidFlagAccessHandler is no longer called for them.
Assisted-by: claude:claude-opus-5-5
Signed-off-by: Eng Zer Jun <[email protected]>1 parent f8edc15 commit 7b8baa0
3 files changed
Lines changed: 95 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4140 | 4140 | | |
4141 | 4141 | | |
4142 | 4142 | | |
| 4143 | + | |
4143 | 4144 | | |
4144 | 4145 | | |
4145 | | - | |
| 4146 | + | |
4146 | 4147 | | |
4147 | 4148 | | |
4148 | | - | |
4149 | | - | |
| 4149 | + | |
| 4150 | + | |
| 4151 | + | |
| 4152 | + | |
4150 | 4153 | | |
4151 | 4154 | | |
4152 | 4155 | | |
| 4156 | + | |
4153 | 4157 | | |
4154 | 4158 | | |
4155 | | - | |
| 4159 | + | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
4156 | 4167 | | |
4157 | 4168 | | |
4158 | 4169 | | |
| |||
4163 | 4174 | | |
4164 | 4175 | | |
4165 | 4176 | | |
4166 | | - | |
4167 | | - | |
4168 | | - | |
| 4177 | + | |
4169 | 4178 | | |
4170 | 4179 | | |
4171 | 4180 | | |
| |||
4175 | 4184 | | |
4176 | 4185 | | |
4177 | 4186 | | |
4178 | | - | |
| 4187 | + | |
4179 | 4188 | | |
4180 | 4189 | | |
4181 | 4190 | | |
| |||
4184 | 4193 | | |
4185 | 4194 | | |
4186 | 4195 | | |
| 4196 | + | |
| 4197 | + | |
| 4198 | + | |
| 4199 | + | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
| 4249 | + | |
| 4250 | + | |
| 4251 | + | |
| 4252 | + | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
4187 | 4264 | | |
4188 | 4265 | | |
4189 | 4266 | | |
| |||
0 commit comments