Comments (4)
Cobra includes command generation. Here are the docs:
https://github.com/spf13/cobra/blob/master/doc/README.md
https://github.com/spf13/cobra/blob/master/doc/md_docs.md
I will definitely play with that a bit and get back here!
from timetrace.
I tried generating some docs, and it works:
Generated docs:
Steps to generate documentation
- Create a script file (in a separate directory)
- Paste the
main
function frommain.go
, but with some modifications
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/dominikbraun/timetrace/out"
"github.com/spf13/cobra/doc"
)
var version = "UNDEFINED"
func main() {
c, err := config.FromFile()
if err != nil {
out.Warn("%s", err.Error())
}
filesystem := fs.New(c)
timetrace := core.New(c, filesystem)
cmd := cli.RootCommand(timetrace, version)
err = doc.GenMarkdownTree(cmd, "./docs")
if err != nil {
log.Fatal(err)
}
}
- Running that script with
go run
places docs in thedocs
directory in cwd
This was the process. We can incorporate it in CI with a bit of refining. @dominikbraun Any suggestions?
from timetrace.
Wow, thanks! This looks exactly like what I've been looking for. I'm going to open some issues for implementing this
from timetrace.
I'm going to close this since we found a way to auto-generate docs. The subsequent issue is #87. Thanks again for figuring this out!
from timetrace.
Related Issues (20)
- Remove `Formatter.FormatXx` methods HOT 1
- Idea:consider adding feature for project management? HOT 2
- Feature Request: Decimal time HOT 1
- Idea: what's the proper way to input time duration when we add records? HOT 1
- Midnight rollover
- Check record collisions when editing a record HOT 3
- Limit tags for `timetrace start`
- Remove exclamation mark (`!`) from error messages HOT 1
- Make help for `timetrace create record` sensitive for `use12hours` HOT 1
- Migrate from CircleCI to Github Actions HOT 3
- Runtime Error when using timetrace start HOT 3
- Tags don't show up in `timetrace report`
- Check record collisions when editing a record HOT 5
- Update brew formula HOT 1
- Feature Request: Add description field in records
- [feature request] list records by specified range HOT 2
- bad CPU type in executable (Apple M2 Max) HOT 1
- Time recording stops at midnight
- Please bump golang.org/x/sys dependency HOT 1
- Should ignore extraneous files in the `.timetrace` directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timetrace.