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

Explore use of reflection to populate Summary and Description automatically #112

Open
rwxrob opened this issue Dec 9, 2022 · 0 comments

Comments

@rwxrob
Copy link
Owner

rwxrob commented Dec 9, 2022

Now that embed is the conventional way to add documentation to commands, it makes sense to explore ways to put all the documentation for a given command into a single file within the desc directory. In fact, where it is stored does matter, we simply have to use Reflect to look for a string that matches the name of the command.

//go:embed desc/foo.md
var fooCmdDoc string

var fooCmd := &Z.Cmd{
  // ...
}

The performance hit from using Reflect is minimal for this type of operation since it is only to display help and would not affect anything else being called dynamically from the help command itself.

The use of docs should, however, be discouraged since it is used for other things like KEG and GitHub pages sites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant