Open satiowadahc opened 3 years ago
output:
man(1) Time Trace man page man(1)
NAME
timetrace - Command Line Based Time Tracker
SYNOPSIS
timetrace [status | list | start | stop | create | delete] [project | record] <module@><project>
DESCRIPTION
timetrace is a simple CLI for tracking your working time.
OPTIONS
status Display the tracking status
list List projects or records.
start Start tracking time to a project or module, -b to make it billable
stop Stop tracking current project
create Create project or module
delete Delete project or module
Examples
timetrace status
timetrace create project grind-beans@make-coffee
timetrace start make-coffee
timetrace stop
timetrace list projects
timetrace list records
BUGS
- See GitHub Issues
AUTHOR
@dominikbraun
0.10.0
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.
IMHO its nice to have something quick and at a glance, add it first, automate later.
Makes sense.
In regards to automation Most projects I work on have the options, version, and date automated and the rest manually entered.
I'm thinking something like a man
page template in Go where options, version, and date can be inserted. What do you think of that, @obnoxiousnerd?
@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? 😅
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 Title
field with timetrace
as value and see what the result looks like (I neither know what we should use as Section
field here) 😄
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