You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @2003Aditya! Thanks for your offering. 🙏 However, we didn't label this with
help wantedContributions welcome
since we need to fx this quickly before the next release. If you can make it, feel free to submit a PR. I think this is a special case.
Also, please note that our preference is to keep the backticks around --watch, so that we can render it correctly on our docs website. It's not really nice at the moment, but keeping the backticks would help when we have fixed the issue with the website docs.
By the way, this seems to be a behaviour in Cobra.
Sorry, I missed that the issue wasn’t labeled help wanted earlier. I kept the backticks around --watch as you mentioned. However, when I do that, Cobra still shows the placeholder as --watch instead of int.
Since this seems to be a behavior from Cobra, could you please guide me on how you’d prefer handling this fix within gh? I’d like to align it exactly with your expectations.
Yeah, it's what Cobra does. I need to dive in the Cobra code and see if there's any way to workaround/disable the behaviour. For now, I guess just simplifying the usage string is fine.
I was thinking of going with this approach to fix the placeholder issue while keeping the backticks for proper docs rendering:
cmd.Flags().IntVarP(&interval, "interval", "i", 10, "Refresh interval in seconds when using --watch flag")
if f := cmd.Flags().Lookup("interval"); f != nil {
f.Usage = "Refresh interval in seconds when using `--watch` flag"
}
This way, Cobra won’t replace the placeholder with --watch in the CLI help output, but the backticks will still be preserved for the website docs.
Activity
2003Aditya commentedon Oct 25, 2025
Hey @babakks! can i work on this ?
Fix --interval flags docs in gh pr checks (cli#11999)
babakks commentedon Oct 25, 2025
Hi @2003Aditya! Thanks for your offering. 🙏 However, we didn't label this with help wantedContributions welcome
since we need to fx this quickly before the next release. If you can make it, feel free to submit a PR. I think this is a special case.
Also, please note that our preference is to keep the backticks around
--watch, so that we can render it correctly on our docs website. It's not really nice at the moment, but keeping the backticks would help when we have fixed the issue with the website docs.By the way, this seems to be a behaviour in Cobra.
2003Aditya commentedon Oct 26, 2025
Hey @babakks, thanks for the clarification! 🙏
Sorry, I missed that the issue wasn’t labeled help wanted earlier. I kept the backticks around
--watchas you mentioned. However, when I do that, Cobra still shows the placeholder as--watchinstead ofint.Since this seems to be a behavior from Cobra, could you please guide me on how you’d prefer handling this fix within gh? I’d like to align it exactly with your expectations.
babakks commentedon Oct 26, 2025
Yeah, it's what Cobra does. I need to dive in the Cobra code and see if there's any way to workaround/disable the behaviour. For now, I guess just simplifying the usage string is fine.
FWIW this is where the usage string is parsed in
spf13/pflag:https://github.com/spf13/pflag/blob/6fcfbc9910e1af538fde31db820be7d1bec231e4/flag.go#L589-L633
2003Aditya commentedon Oct 28, 2025
Hey @babakks 👋
I was thinking of going with this approach to fix the placeholder issue while keeping the backticks for proper docs rendering:
This way, Cobra won’t replace the placeholder with --watch in the CLI help output, but the backticks will still be preserved for the website docs.
Does this look good to you
babakks commentedon Oct 28, 2025
@2003Aditya, this works but I'd rather keep it simple, like other flags, and avoid overriding Cobra like this.
2003Aditya commentedon Oct 29, 2025
@babakks can i do this #12021 (comment) and make the PR?
babakks commentedon Oct 29, 2025
Yup, go ahead.