-
Notifications
You must be signed in to change notification settings - Fork 832
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: plugin documentation callback support 🎉 #757
Conversation
9f9373a
to
7ba1489
Compare
7ba1489
to
a774850
Compare
I'll give this a test over the next 48hrs with a plugin. Externally sourced data is going to be tricky to format well (80 char linewrap or columns etc). The only solution to this would be where we get control of parsing the content before writing to STDOUT, and in that we could either capture (redirect) the output from the plugin or provide variables for the plugin to populate which we would then print. I raise this now (though we can certainly iterate on this) because I would like to address output to both STD OUT/ERR across the board for 0.9.0 milestone (I'll create all the issues and milestone for this tomorrow) |
@jthegedus yes that is one of my concerns with this. The output is so open ended that even if all plugins comply with the requirements I've specified here there will still be variations between plugins. I don't think this is ideal. One alternative solution would be to have multiple callbacks for each kind of help for each plugin. So we could have a callback named |
I'm open to whatever everything thinks is best. I only wrote this code today and haven't used it extensively on my own, so I'll try to get more experience with this feature before proceeding with anything. |
I like that our plugin interface for commands requires a specific format, and that we capture the output from the plugins and parse them ourselves in the core to STDOUT. Perhaps we can apply the same thing here requiring specific formats for each type of documentation?
What are your thoughts on this? Whether this would be implemented as separate callbacks is another question. It is perhaps better to separate them so the output can be format in a more distinct way. IF they were separate and optional, would we notify the users at all or just skip as we do now? (I'm just trying to consider the feedback we're getting regarding exit codes and our use of stderr and if this is something users would like to know at all. IE is the absence of Re man pages: I am also unsure how they work and perhaps it is time I learned 😅 I don't want to hold up the work being done here, but realise changing our plugin API later may cause issues and it may be easier to address these now (though we're pre 1.0 so that's part of the semver contract) |
A single column of data representing package names? like:
This may be too restrictive. Sometimes dependencies may need to be available in OS package managers, and some package managers may lack certain packages, so some instructions on manually installation of dependencies may be needed occasionally. I guess we could make things work if each line of output represented only one dependency.
I think this would have to be freeform as well. Configuration instructions will vary greatly between tools and operating systems. Instructions may include setting environment variables, creating/editing config files, etc... To much to enforce a strict structure on the output.
This can be one link per line. Formats could be:
Or:
Even with both formats it should give us enough control over the final output. |
I think the callbacks should be separate and optional. I think if say the
Not certain, but I guess perhaps that should indicate no deps? I think plugin authors should either implement all needed callbacks for help, or none of them at all. |
@jthegedus I found this answer about man pages helpful - https://unix.stackexchange.com/a/3587/74959 Working on this again today. Hopefully will get everything updated in a couple hours. |
@jthegedus the code has been updated based on our discussion. I may write some additional unit tests later today, but either way the code is ready for you to review again. |
612acc4
to
72b0536
Compare
print_plugin_help() { | ||
local plugin_path=$1 | ||
|
||
# Eventually @jthegedus or someone else will format the output from these |
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.
Yes!
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.
This looks great! Awesome work
Summary
help
callback scripts for pluginshelp
callback scripts on the create plugins pageFixes: #512