made cli into sub files for modularity

This commit is contained in:
2021-03-29 01:57:49 +04:00
parent 1258b16a84
commit a7dc4cbce4
6 changed files with 107 additions and 51 deletions

19
cmd/action.go Normal file
View 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
View 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,
},
}