File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -73,24 +73,23 @@ func printPluginInfo(out io.Writer, plugin index.Plugin) {
73
73
fmt .Fprintf (out , "DESCRIPTION: \n %s\n " , plugin .Spec .Description )
74
74
}
75
75
if plugin .Spec .Caveats != "" {
76
- fmt .Fprintln (out , prepCaveats (plugin .Spec .Caveats ))
76
+ fmt .Fprintf (out , "CAVEATS: \n %s \n " , indent (plugin .Spec .Caveats ))
77
77
}
78
78
}
79
79
80
- // prepCaveats converts caveats string to an indented format ready for printing.
80
+ // indent converts strings to an indented format ready for printing.
81
81
// Example:
82
82
//
83
- // CAVEATS:
84
83
// \
85
84
// | This plugin is great, use it with great care.
86
85
// | Also, plugin will require the following programs to run:
87
86
// | * jq
88
87
// | * base64
89
88
// /
90
- func prepCaveats (s string ) string {
91
- out := "CAVEATS: \n \\ \n "
89
+ func indent (s string ) string {
90
+ out := "\\ \n "
92
91
s = strings .TrimRightFunc (s , unicode .IsSpace )
93
- out += regexp .MustCompile ("(?m)^" ).ReplaceAllString (s , " | " )
92
+ out += regexp .MustCompile ("(?m)^" ).ReplaceAllString (s , " | " )
94
93
out += "\n /"
95
94
return out
96
95
}
Original file line number Diff line number Diff line change @@ -132,10 +132,15 @@ Remarks:
132
132
failed = append (failed , plugin .Name )
133
133
continue
134
134
}
135
+ fmt .Fprintf (os .Stderr , "Installed plugin: %s\n " , plugin .Name )
136
+ output := fmt .Sprintf ("Use this plugin:\n \t kubectl %s\n " , plugin .Name )
137
+ if plugin .Spec .Homepage != "" {
138
+ output += fmt .Sprintf ("Documentation:\n \t %s\n " , plugin .Spec .Homepage )
139
+ }
135
140
if plugin .Spec .Caveats != "" {
136
- fmt .Fprintln ( os . Stderr , prepCaveats (plugin .Spec .Caveats ))
141
+ output += fmt .Sprintf ( "Caveats: \n %s \n " , indent (plugin .Spec .Caveats ))
137
142
}
138
- fmt .Fprintf (os .Stderr , "Installed plugin: %s \n " , plugin . Name )
143
+ fmt .Fprintln (os .Stderr , indent ( output ) )
139
144
internal .PrintSecurityNotice ()
140
145
}
141
146
if len (failed ) > 0 {
You can’t perform that action at this time.
0 commit comments