-
Notifications
You must be signed in to change notification settings - Fork 375
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
rfc: gno doc command #522
Comments
We will probably have more metadata at the (see #498), and we should start parsing comments to extend the understanding of packages by our VM and dev tools.
Yes.
Yep, also related to
Later yes; short term, no. The current focus for Step 2 will create and integrate tools to play with the production state, i.e., discovering and inspecting realm data, synchronizing it locally, etc.
Yep, the idea is to make this transparent with the following:
I love all the enumerated ideas 👍 . Question: do you plan to work on this as a whole, or can you split this into smaller parts? Thank you |
Smaller parts, roughly matching the 5 paragraphs I would think. So a first POC on the standard library, and then build up from there. Also to keep the PRs small and focused :) |
We need to enhance our approach to documentation. Here's how:
In short:
|
The underlying idea is to provide roughly the same functionality as the
go doc
command, as well potentially that ofgodoc
(ie. http documentation viewer/generator).So the purpose and scope is that to be a central command and reference points to all things related to technical documentation. It should not contain tutorials and guides, but it should contain precise and up-to-date information on all tooling, commands, and specifications related to the Gnolang language.
The way I see it there are a few different types of documentation we should provide:
Standard library ✔️
Examples:
gnodev doc errors
,gnodev doc std
While most of these can be provided in an identical fashion to how Go doc parses documentation on symbols and packages, there should also be documentation for "native" types which are mapped to go types using
stdlibs/stdlibs.go
. The way this should be done is by declaring the prototype without the documentation, like Go for does for the symbols implemented in assembly. Providing them directly as prototypes in code also helps to develop future tooling (e.g. code autocompletion, which can be based only on the AST without exceptions for builtin code).There should also be a documentation-only builtin package, similar to Go's, providing documentation about builtin functions and types.
gnodev
tries to determine the directory ofstdlibs
in the same way asgnodev test
currently does, and provides the--root-dir
function to that effect. Potentially in the future we could provide some functionality similar toGOROOT
, although this is more in the scope of #460.Local packages and realms ✔️
Examples:
gnodev doc .
,gnodev doc ./examples/gno.land/p/demo/avl
This should work roughly as the above, parsing the AST with the comments to provide documentation about the package.
References to other packages are parsed and understood in a local context if subpackages of the current (determined through gno.mod). Otherwise, they are understood as remote packages and the
--remote
flag is used as below (though for CLI usage the remote will not be used).❓ Should we add further metadata like the one that gnoview displayed, implementing #477?
Remote packages and realms
Examples:
gnodev doc --remote 'staging.gno.land:36657' gno.land/p/demo/avl
This should query the remote server for documentation about a package or a realm. So the functionality is similar to that returned by the ABCI query
vm/qfuncs
- though for this use case there should probably be a specific query which also works on packages and is designed specifically for serving on the documentation (so has raw package documentation and documentation for all the exported symbols, ie. used as a documentation for programming realms instead of for making calls using maketx). Though for the exported functions of a realm, it could provide the same functionality that?help
is currently providing (ie. showing the commands to interact with the contract).Manually written manual pages
Examples:
gnodev man
,gnodev man gnokey
,gnodev man gnomod
,gnodev man abci vm/qeval
.Like UNIX
man
, but Markdown based. This would pull markdown files as topics from thedocs
directory in the root, or it could also be built into gnodev usinggo:embed
(possibly guarded by a build tag). So these provide manually written documentation about topics which are related to programming in Gno and using the command line tools of the project. Again, these are not how-tos, but specific documentation about what each flag does.HTTP viewer and generator
Considerable when everything else is done and implemented. But many of these references could also be useful to publish online, or simply for users who prefer a graphical interface to view all documentation locally when developing. So the gno.land website could be extended to provide all of the documentation provided in the command
gnodev doc
andgnodev man
, in a similar fashion to whatgodoc
does. This would mean?help
to provide also documentation for other symbols which are not smart contracts/man
sub-path where the manual pages can be found?help
also on packages, only to the extent of providing developer documentation (not smart contracts)Options/functionality overview
--remote
,--root-dir
,--home
like in other commands.--all
likego doc
(when asking for the documentation of a package, expand all symbols)--src
likego doc
(show the full source code for the symbol)--unexported
likego doc
(show/document unexported symbols, unavailable for remote querying).For
gnodev man
, only--root-dir
appliesFeedback is very welcome, also on the design of the command line and flags.
Related: #28, #379, #408, #477
The text was updated successfully, but these errors were encountered: