-
Notifications
You must be signed in to change notification settings - Fork 78
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
Man Page #136
Comments
output:
|
I wonder if this can be somewhat auto-generated with Cobra like in #84 and worked into the CI? @obnoxiousnerd |
IMHO its nice to have something quick and at a glance, add it first, automate later. In regards to automation Most projects I work on have the options, version, and date automated and the rest manually entered. |
Makes sense.
I'm thinking something like a |
@aligator PTAL |
Hey guys! I've been observing the conversation, however, I've been busy for a while, so couldn't help in anything. Borrowing from @Kevin-Mok's idea, using Cobra's man page creation for generating documentation of all the commands, and then inserting them with version/date in a template should suffice our use case. |
@obnoxiousnerd Do you have experience in creating those man pages using Cobra? It looks pretty good to me and we really need man pages. 🤔 |
I have experience of only reading man pages 😅. But creating them seems doable by looking at the API. I'll try. |
Sorry, it's taking longer than expected. But hope we'll get this done. 🙂 |
I am close to generating the type of man pages we need, but I can't figure out what to put in the GenManHeader struct (https://pkg.go.dev/github.com/spf13/cobra/doc#GenManHeader). Can I get some help? 😅 |
@obnoxiousnerd I'd suggest to just set the |
Check out this script: package main
import (
"log"
"github.com/dominikbraun/timetrace/cli"
"github.com/dominikbraun/timetrace/config"
"github.com/dominikbraun/timetrace/core"
"github.com/dominikbraun/timetrace/fs"
"github.com/spf13/cobra/doc"
)
var version = "UNDEFINED"
func main() {
timetraceStub := core.New(&config.Config{}, &fs.Fs{})
cmd := cli.RootCommand(timetraceStub, version)
err := doc.GenMarkdownTree(cmd, "./docs/markdown")
if err != nil {
log.Fatalf("Could not generate markdown docs: %v\n", err)
}
err = doc.GenManTree(cmd, &doc.GenManHeader{Title: cmd.Name(), Section: "1"}, "./docs/man")
if err != nil {
log.Fatalf("Could not generate man docs: %v\n", err)
}
} This works fairly well, but try running this and inspect the output since I don't really know how the docs should be. |
Being lazy and don't want to clone the repo, feel free to add it in.
Save this excerpt as timetrace.1
gzip timetrace.1
sudo cp timetrace.1.gz /usr/share/man/man1/timetrace.1.gz
The text was updated successfully, but these errors were encountered: