Check plugin name is not used

Signed-off-by: tison <wander4096@gmail.com>
(cherry picked from commit 5196b8431a)
release-4.0
tison 3 months ago committed by Scott Rigby
parent 0fd2c418b0
commit 30bfd57c5f
No known key found for this signature in database
GPG Key ID: C7C6FBB5B91C1155

@ -132,7 +132,13 @@ func loadCLIPlugins(baseCmd *cobra.Command, out io.Writer) {
DisableFlagParsing: true,
}
// TODO: Make sure a command with this name does not already exist.
for _, cmd := range baseCmd.Commands() {
if cmd.Name() == c.Name() {
fmt.Fprintf(os.Stderr, "failed to load plugins: name conflicts %s\n", c.Name())
return
}
}
baseCmd.AddCommand(c)
// For completion, we try to load more details about the plugins so as to allow for command and

Loading…
Cancel
Save