Repository navigation
Fix --interval option docs in pr checks #11999
Description
Activity
Hey @babakks! can i work on this ?
- added a commit that references this issue
on Oct 25, 2025 Hi @2003Aditya! Thanks for your offering. 🙏 However, we didn't label this with help wanted
Contributions 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.
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.
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-L633Hey @babakks 👋
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.
Does this look good to you
@2003Aditya, this works but I'd rather keep it simple, like other flags, and avoid overriding Cobra like this.
@babakks can i do this #12021 (comment) and make the PR?
Yup, go ahead.
Just noticed the usage doc for the
--intervalflag inpr checksshows--watchas placeholder:This has to be fixed into something like this: