added generate function to the ClI
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/client"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/generate"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/p2p"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/plugin"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server"
|
||||
@@ -243,6 +244,24 @@ var CliAction = func(ctx *cli.Context) error {
|
||||
client.PrettyPrint(groups)
|
||||
}
|
||||
}
|
||||
// -- REMOVE ON REGULAR RELEASE --
|
||||
// when flag --gen is called an extension
|
||||
// of the project is created to repurpose
|
||||
// the project for custom purpose
|
||||
if Generate != "" {
|
||||
err := generate.GenerateNewProject(Generate)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
fmt.Println("Created new folder: " + Generate)
|
||||
fmt.Println("1. Enter inside " + Generate + "directory")
|
||||
fmt.Println("2. go mod init <name of your module (ex: github.com/akilan1999/lol)>")
|
||||
fmt.Println("3. sh install.sh " + Generate)
|
||||
fmt.Println("4. ./" + Generate + " -h (This is to test if the binary is working")
|
||||
}
|
||||
}
|
||||
//--------------------------------
|
||||
|
||||
|
||||
|
||||
return nil
|
||||
|
||||
14
cmd/flags.go
14
cmd/flags.go
@@ -28,6 +28,10 @@ var (
|
||||
Groups bool
|
||||
RemoveContainerGroup bool
|
||||
RemoveGroup string
|
||||
// Generate only allowed in dev release
|
||||
// -- REMOVE ON REGULAR RELEASE --
|
||||
Generate string
|
||||
//--------------------------------
|
||||
)
|
||||
|
||||
var AppConfigFlags = []cli.Flag{
|
||||
@@ -187,4 +191,14 @@ var AppConfigFlags = []cli.Flag{
|
||||
EnvVars: []string{"REMOVE_GROUP"},
|
||||
Destination: &RemoveGroup,
|
||||
},
|
||||
// Generate only allowed in dev release
|
||||
// -- REMOVE ON REGULAR RELEASE --
|
||||
&cli.StringFlag{
|
||||
Name: "Generate",
|
||||
Aliases: []string{"gen"},
|
||||
Usage: "Generates a new copy of P2PRC which can be modified based on your needs",
|
||||
EnvVars: []string{"GENERATE"},
|
||||
Destination: &Generate,
|
||||
},
|
||||
//--------------------------------
|
||||
}
|
||||
Reference in New Issue
Block a user