Skip to content

Commit

Permalink
Get CMD
Browse files Browse the repository at this point in the history
  • Loading branch information
arrase committed Jul 5, 2020
1 parent 3579ce7 commit 79e3c82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 19 additions & 0 deletions getCmd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cobraplugins

import (
"github.com/spf13/cobra"
"plugin"
)

func GetCmd(pluginPath, cmdName string) *cobra.Command {
p, err := plugin.Open(pluginPath)
if err != nil {
panic(err)
}
b, err := p.Lookup(cmdName)
if err != nil {
panic(err)
}

retrun *b.(**cobra.Command)
}
19 changes: 0 additions & 19 deletions load.go

This file was deleted.

0 comments on commit 79e3c82

Please sign in to comment.