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

Generate Manpage from Docu #200

Merged
merged 1 commit into from
Aug 23, 2021
Merged

Conversation

Bloodchiefy
Copy link
Contributor

@Bloodchiefy Bloodchiefy commented Aug 2, 2021

Generated manpage with pandoc from README.md

Command used: pandoc --standalone --to man README.md -o knoxite.1

Open questions:

  • Shall the manpage be created from the README or the knoxite/website documentation?
  • Shall the generation be integrated into github workflows?
  • The manpage needs to be moved to /usr/local/share/man/man1 as far as I know. So this needs to be done in an installed script for knoxite, right?
  • Clearify command usage documentation (< or [)
  • Check if scripts and docs pathnames are fine
  • Check if code is fine (remove probable uncommented code lines)

Closes #143

@muesli
Copy link
Member

muesli commented Aug 2, 2021

Just a heads up, here's yet another option we have: we're using cobra to define our command-line arguments and flags, which also comes with a documentation generator that builds the man page directly from the source code and command definitions.

@Bloodchiefy
Copy link
Contributor Author

Alright, thanks, that helped.

@Bloodchiefy Bloodchiefy force-pushed the generate-man-page branch 11 times, most recently from 9a41366 to 682dc77 Compare August 3, 2021 22:15
@Bloodchiefy
Copy link
Contributor Author

So, docs workflow is sadly not working yet, I call it another day. For the man pages generation with cobra, this helped: https://github.com/spf13/cobra/blob/master/doc/man_docs.md

I changed in the Use of each cobra command in knoxite, since the < and > symbols are getting cobra confused, thinking they may be html-tags. I will probably go back on that, and change those symbols with &lt; and &gt; to escape those symbols, hopefully the command line picks up on that. Otherwise, this discussion ment, usage of [ and ] is considered as best practice:
spf13/cobra#1137

@Bloodchiefy Bloodchiefy force-pushed the generate-man-page branch 8 times, most recently from 80d5b3c to 0c1a5e0 Compare August 5, 2021 08:40
.github/workflows/docs.yml Outdated Show resolved Hide resolved
.github/workflows/docs.yml Outdated Show resolved Hide resolved
- Adjust workflow for man page generation
- New script and workflow to generate documentation
- Changes docs workflow order
- Adds build tag "docs" to docs subcommand
- Runs docs only on knoxite/knoxite repo
@Bloodchiefy
Copy link
Contributor Author

To prevent the generation to always auto-commit files, if only the date would change, I extended the Header-attribute of man pages:

t, _ := time.Parse(time.RFC822, "09 Aug 21 10:00 CEST")
header := &doc.GenManHeader{
		Title:   "KNOXITE",
		Section: "1",
		Date:    &t,
		Source:  "Auto generated by knoxite/knoxite",
	}

If the date needs to be changed, it has to be done manually here. The Source is set to Auto generated by knoxite/knoxite, I hope, that it is fine.

Copy link
Member

@muesli muesli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@muesli muesli merged commit 714ffb1 into knoxite:master Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write/generate man page
2 participants