added basic commands

This commit is contained in:
2020-12-26 22:15:17 +04:00
parent 47f044381c
commit f82ca62038
3 changed files with 34 additions and 11 deletions

34
main.go
View File

@@ -4,19 +4,47 @@ import (
"log"
"os"
"github.com/urfave/cli/v2"
"fmt"
)
// VERSION specifies the version of the platform
var VERSION = "0.0.1"
func main() {
var mode string
app := &cli.App{
Name: "p2p-redering-computation",
Usage: "allows you to batch tasks in a peer to peer network",
Version: VERSION,
/*Commands: []*cli.Command{
cmd.CmdStart,
},*/
Flags: []cli.Flag {
&cli.StringFlag{
Name: "mode",
Value: "client",
Usage: "Specifies mode of running",
Destination: &mode,
},
},
Action: func(c *cli.Context) error {
/*
Example usage:
name := "someone"
if c.NArg() > 0 {
name = c.Args().Get(0)
}
if language == "spanish" {
fmt.Println("Hola", name)
} else {
fmt.Println("Hello", name)
}
return nil
*/
fmt.Println(mode)
if c.NArg() < 0 {
fmt.Println(c.Args().Get(0))
}
return nil
},
}
err := app.Run(os.Args)