Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for custom manpage section #5

Open
anpep opened this issue Jul 4, 2023 · 1 comment
Open

Allow for custom manpage section #5

anpep opened this issue Jul 4, 2023 · 1 comment

Comments

@anpep
Copy link

anpep commented Jul 4, 2023

A way for providing a custom manpage section could prove very useful so that we don't depend on hacks on the application side to fix this manually.

go-flags/man.go

Line 197 in 105d09a

fmt.Fprintf(wr, ".TH %s 1 \"%s\"\n", manQuote(p.Name), t.Format("2 January 2006"))

Example hack on canonical/pebble:
https://github.com/canonical/pebble/blob/8e96c74a21cc104ac722bf4160d7db6e11ddeb60/internals/cli/cmd_help.go#L93-L120

@thp-canonical
Copy link

This also affects snap help --man:
https://github.com/snapcore/snapd/blob/d3d978da7b2089186cb8b9e492198a3090d65dc2/cmd/snap/cmd_help.go#L103-L130

One option (if we can't store/retrieve the section information in some other place?) could be to add a new function to man.go:

func (p *Parser) WriteManPageForSection(wr io.Writer, section string) {
  ...
}

And update the existing function (for existing user code) to just:

func (p *Parser) WriteManPage(wr io.Writer) {
    WriteManPageForSection(wr, '1')
}

Pebble and snap could then call WriteManPageForSection(out, '8').

Together with the new groff in 16.04 (see LP#1814767 -- 14.04 will go out of support next year?), this would allow the manfixer in pebble and snap to be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants