added plugin detected
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/client"
|
"git.sr.ht/~akilan1999/p2p-rendering-computation/client"
|
||||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/p2p"
|
"git.sr.ht/~akilan1999/p2p-rendering-computation/p2p"
|
||||||
|
"git.sr.ht/~akilan1999/p2p-rendering-computation/plugin"
|
||||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server"
|
"git.sr.ht/~akilan1999/p2p-rendering-computation/server"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
@@ -124,6 +125,16 @@ var CliAction = func(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the view plugin flag is called then display all
|
||||||
|
// plugins available
|
||||||
|
if ViewPlugin {
|
||||||
|
plugins ,err := plugin.DetectPlugins()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Print(err)
|
||||||
|
}
|
||||||
|
client.PrettyPrint(plugins)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ var (
|
|||||||
ServerList bool
|
ServerList bool
|
||||||
SetDefaultConfig bool
|
SetDefaultConfig bool
|
||||||
NetworkInterface bool
|
NetworkInterface bool
|
||||||
|
ViewPlugin bool
|
||||||
)
|
)
|
||||||
|
|
||||||
var AppConfigFlags = []cli.Flag{
|
var AppConfigFlags = []cli.Flag{
|
||||||
@@ -122,4 +123,11 @@ var AppConfigFlags = []cli.Flag{
|
|||||||
EnvVars: []string{"NETWORK_INTERFACE"},
|
EnvVars: []string{"NETWORK_INTERFACE"},
|
||||||
Destination: &NetworkInterface,
|
Destination: &NetworkInterface,
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "ViewPlugins",
|
||||||
|
Aliases: []string{"vp"},
|
||||||
|
Usage: "Shows plugins available to be executed",
|
||||||
|
EnvVars: []string{"VIEW_PLUGIN"},
|
||||||
|
Destination: &ViewPlugin,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
11
plugin/plugin_test.go
Normal file
11
plugin/plugin_test.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package plugin
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
// Test if the dummy plugin added is detected
|
||||||
|
func TestDetectPlugins(t *testing.T) {
|
||||||
|
_, err := DetectPlugins()
|
||||||
|
if err != nil {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user