made cli into sub files for modularity
This commit is contained in:
19
cmd/action.go
Normal file
19
cmd/action.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var CliAction = func(ctx *cli.Context) error {
|
||||
if Mode == "server" {
|
||||
server.Server()
|
||||
}
|
||||
|
||||
//Call function to create Docker container
|
||||
if IpAddress != "" {
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
31
cmd/flags.go
Normal file
31
cmd/flags.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var Mode,IpAddress string
|
||||
var List_servers, Ip_table bool
|
||||
|
||||
var AppConfigFlags = []cli.Flag{
|
||||
// Deprecated to be implemented using GRPC
|
||||
&cli.StringFlag{
|
||||
Name: "Mode",
|
||||
Value: "server",
|
||||
Usage: "Specifies mode of running",
|
||||
EnvVars: []string{"P2P_MODE"},
|
||||
Destination: &Mode,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "ListServers",
|
||||
Usage: "List servers which can render tasks",
|
||||
EnvVars: []string{"LIST_SERVERS"},
|
||||
Destination: &List_servers,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "CreateVM",
|
||||
Usage: "Creates Docker container on the selected server",
|
||||
EnvVars: []string{"CREATE_VM"},
|
||||
Destination: &IpAddress,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user