-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(docs): generate cli docs directly from the struct #12717
base: master
Are you sure you want to change the base?
feat(docs): generate cli docs directly from the struct #12717
Conversation
Looks like a lot of the logic for this lives in https://github.com/urfave/cli/blob/main/help.go and the templates in here (unfortunately not exported!) are here: https://github.com/urfave/cli/blob/main/template.go Use this as an exercise in minimising the diff, that's your challenge - how can you get to near zero red/green lines in the diff here for the documentation output, aiming to only make changes where the existing script is getting it wrong (mostly missing some things I believe). |
1f2c2c4
to
f616568
Compare
@akaladarshi : I assume you'll re-request review when you're ready for it to be looked at again. |
Very close @akaladarshi, good work so far. I haven't done an in-depth review of the actual code, I'm mainly looking at the output and assuming that the code is good, I'll look over that next. |
@rvagg I think I found a minimum solution for this we can directly use the urface cli package for generating, Initially I though we need to print everything (hidden), but this will directly print the correct format value. customAppData := func() map[string]interface{} {
return map[string]interface{}{
"ExtraInfo": g.app.ExtraInfo,
}
}
cli.HelpPrinterCustom(header, cli.AppHelpTemplate, g.app, customAppData()) |
Removed the above change in favour of |
b9a161b
to
7fe23b0
Compare
Squashed down to a single commit and rebased onto current master in this branch. |
After a @rjan90 please have a look at the changes I made in the head commit here, I've put |
still requires compiled binaries to produce the config, separate from docsgen-cli which does not require them
7c96bf3
to
14ca842
Compare
I think follow-up work here to make the config output should be straightforward but it would be worth testing whether it should be part of the same binary or not, it might be faster to keep it in the same thing rather than have two binaries it has to setup and execute. |
OK, nevermind about the follow-up task, I just bundled it in here and got rid of the need to
@rjan90 if you wouldn't mind reviewing that would be appreciated. You're welcome to focus on the two additional commits I added since they are minimal and I already reviewed the larger initial commit. |
7ce784c
to
db0dc42
Compare
lotus-miner log list - List log systems | ||
|
||
USAGE: | ||
lotus log list [command options] [arguments...] | ||
lotus-miner log list [command options] [arguments...] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is correct? If I understand the intent of the changes/PR in general, it seems like we will still have lotus auth api-info
, lotus log list
, lotus log set-level
and lotus log alerts
commands, and therefor having these being written as lotus-miner commands in the Lotus CLI docs seems wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, you're right, good catch; the annoyance is that the command objects are used in both places and they get a certain amount of internal state built up over use, and we use them twice so this name gets sticky; I'll figure out a fix
Related Issues
Fixes: #12706