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

feat(cmd/gno): initial documentation command for stdlibs and example packages #610

Merged
merged 34 commits into from
May 12, 2023

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented Mar 17, 2023

See #522, #526.

This introduces a doc package which is in some ways redundant to that implemented by Yassin in #526. They are meant to eventually be the same package if that PR is merged; but that is to be done perhaps in a future PR.

This PR only supports stdlibs packages, and packages from the examples subdirectory in the gno root, for now. With a PR following this one, I would also like to add support for packages and realms using gno.mod.

Quick asciicast:

asciicast

(The asciicast for some reason adds gnodev before the output of the program - I don't know why this happens, but it's not actually output:)

image

@thehowl thehowl self-assigned this Mar 17, 2023
@thehowl thehowl linked an issue Mar 17, 2023 that may be closed by this pull request
@zivkovicmilos
Copy link
Member

@thehowl

uses asciinema

I see you're a man of culture 🙂
Unrelated to the PR, you can use agg (successor to asciicast2gif) to turn your asciinema recordings into gifs

@thehowl thehowl changed the title feat(gnodev): initial documentation command for stdlibs packages feat(gnodev): initial documentation command for stdlibs and example packages Mar 22, 2023
@thehowl thehowl marked this pull request as ready for review March 22, 2023 19:49
@thehowl thehowl requested a review from a team as a code owner March 22, 2023 19:49
@thehowl
Copy link
Member Author

thehowl commented Mar 22, 2023

PR is now ready for review. I've had to rework a few parts to reduce some unneeded complexity and make sure that we could supply the lacking of go/build appropriately. I've also added support for the "examples" subdirectory in the gno root, as it was essentially very easy to do without significant side effects. The step after this one would involve supporting directories with gno.mod.

Test coverage is around 75%, mostly a few things things missing in print.go but behaviour should be good to go, and the command works also on local directories if you run on a directory inside root-dir.

gnovm/cmd/gno/build.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/doc.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/doc.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/dirs.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/dirs.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/doc.go Outdated Show resolved Hide resolved
@thehowl thehowl requested a review from moul April 18, 2023 19:54
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

This was definitely a focused read, so word of warning for anyone going into these code changes

I've probably missed a few things in the parsing code that requires context knowledge. Overall it looks good, and it works great 💯

I've left a few minor comments, otherwise we are good to go 🚀

Would love to see an option for the doc command where we can export it out into a file, or even attach a special writer for example Markdown / HTML... (sort of like JSDoc generators)

gnovm/cmd/gno/doc.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/dirs.go Show resolved Hide resolved
gnovm/cmd/gno/doc.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/print.go Show resolved Hide resolved
gnovm/cmd/gno/doc.go Show resolved Hide resolved
gnovm/pkg/doc/doc.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/doc.go Outdated Show resolved Hide resolved
gnovm/pkg/doc/doc.go Show resolved Hide resolved
gnovm/pkg/doc/doc.go Show resolved Hide resolved
gnovm/pkg/doc/doc.go Outdated Show resolved Hide resolved
@thehowl thehowl changed the title feat(gnodev): initial documentation command for stdlibs and example packages feat(cmd/gno): initial documentation command for stdlibs and example packages May 9, 2023
@thehowl
Copy link
Member Author

thehowl commented May 9, 2023

all code review issues replied to and/or addressed :)

@zivkovicmilos
Copy link
Member

@ajnavarro
All convos have been resolved 💯

@thehowl
Some lint checks are failing, after we resolve those you are clear to squash and merge 🚀

@thehowl thehowl merged commit 0985fb1 into gnolang:master May 12, 2023
moul-bot pushed a commit that referenced this pull request May 19, 2023
…packages (#610)

* feat(gnodev): add preliminary doc command, refactor common flags verbose and root-dir

* feat(gnodev): initial documentation command for stdlibs packages

* chore: remove accidental log line

* chore: linter

* feat(commands/doc): add support for examples directory

* chore: prefer writing to stdout directly instead of using a buffer

* fix(doc): improve arg parsing, more tests

* tests: add tests for Document

* chore: fix typo

* update to new dir structure

* fmt

* Update gnovm/cmd/gno/doc.go

Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>

* typo

* Revert "feat(gnodev): add preliminary doc command, refactor common flags verbose and root-dir"

This reverts commit 243d24c.

* change documentable iface

* add doc test

* address changes requested from code review

* fix typo

* code review changes

* unexport dirs

* some typos, some error logging

* better and more consistent error handling

* use errors.Is for comparison

* empty commit to trigger github workflow

---------

Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

rfc: gno doc command
4 participants