-
Notifications
You must be signed in to change notification settings - Fork 363
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
Add script to generate plugin overview page #260
Add script to generate plugin overview page #260
Conversation
Codecov Report
@@ Coverage Diff @@
## master #260 +/- ##
=======================================
Coverage 55.66% 55.66%
=======================================
Files 19 19
Lines 918 918
=======================================
Hits 511 511
Misses 355 355
Partials 52 52 Continue to review full report at Codecov.
|
hack/generate-plugin-overview.go
Outdated
} | ||
|
||
func printTableHeader(out io.Writer) { | ||
printRow(out, "Name", "Description", "GitHub Stars") |
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.
Can I recommend actually spitting out html tables?
It's often much better to have html tables in .md files as they're more reliable and bring more freedom that probably will be necessary in the future.
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.
Sure. However, this also means that we should also translate the markdown used in some of the short-descriptions into html. I think a common choice for that task is blackfriday (used by hugo for example).
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 think this cmd/foo tool can even have its own go.mod. :)
Do you think we can have this in cmd/[name]/ instead ? |
Yeah why not. |
Let's move this PR forward by moving the file to cmd/gen-plugin-list/main.go |
d2699d9
to
22e7385
Compare
Moving the file was not the problem, converting the table to html was. I didn't really find a clean solution here to prevent |
🤔 lets keep .md, then. |
This prepares to add additional dependencies to plugin-overview
22e7385
to
a6fecb6
Compare
Ok, I reverted to the pure markdown version again. |
cmd/plugin-overview/go.mod
Outdated
sigs.k8s.io/krew v0.2.1 | ||
) | ||
|
||
replace sigs.k8s.io/krew => ../.. |
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 am suspecting this would cause issues if I go to a computer and cleanly do sigs.k8s.io/krew/cmd/plugin-overview
.
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, probably. The problem is that I want to use the homepage field, which was added after the last krew release.
I pinned the import to the current master HEAD instead, to solve the issue you raised.
cmd/plugin-overview/go.mod
Outdated
@@ -0,0 +1,12 @@ | |||
module sigs.k8s.io/krew/cmd/plugin-overview |
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.
let's call this gen-plugin-overviews
or generate-
.
otherwise this tool's name is unclear about what it does.
) | ||
|
||
func main() { | ||
pluginsDir := pflag.String("plugins-dir", "", "The directory containing the plugin manifests") |
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.
do you get much out of pflag vs stdlib pkg/flags here?
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.
No. This is a leftover from when this tool was not its own module.
Only the usage output looks a bit weird when using vanilla flags
, though.
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 wouldn't worry about usage as it's not a primary tool.
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 see your point now. glog
hijacks the flags smh.
- rename to `generate-plugin-overview` - pin krew import to specific version - use vanilla flag instead of pflag
require ( | ||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b | ||
github.com/pkg/errors v0.8.1 // indirect | ||
sigs.k8s.io/krew v0.2.2-0.20190724210953-8867a94acd6d |
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.
funny enough this doesn't build from root
$ go build ./cmd/generate-plugin-overview
go: finding sigs.k8s.io/krew/cmd/generate-plugin-overview latest
go: finding sigs.k8s.io/krew/cmd latest
can't load package: package sigs.k8s.io/krew/cmd/generate-plugin-overview: unknown import path "sigs.k8s.io/krew/cmd/generate-plugin-overview": cannot find module providing package sigs.k8s.io/krew/cmd/generate-plugin-overview
but if you ./cmd/generate-plugin-overview
then go build .
it works haha.
"regexp" | ||
"strings" | ||
|
||
"github.com/golang/glog" |
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.
maybe don't import glog (and just use log.Printf+os.Exit) if it helps you avoid glog hijacking flags
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 tried, but it didn't really work. It's fine either way. As you said, the tool is just a little helper.
I just tried and I like it! Do you envision we would require the output file on krew-index repository to be up to date (as a travis check) or should we update it ourselves periodically? Earlier option sounds like it's a burden during onboarding new plugins. |
- Change header - Add footer - switch from `glog` to vanilla `log` - change label for stars
I wouldn't be so strict about the overview. Initially, manual sounds right, as there is a) not so many new plugins In the long run, my favorite solution would be to let a hook add additional commits, when the overview has changed. Or at least, a PR for the change is created. But that sounds like more work than we are saving for a long time. |
Thanks for developing this. I'm thinking we host this on |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahmetb, corneliusweig The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Close #258