Moved commands to 'Commands' folder
This commit is contained in:
parent
44b912ed43
commit
7ff62e1a06
3 changed files with 61 additions and 39 deletions
27
Commands/PullCommand.go
Normal file
27
Commands/PullCommand.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package Commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"log"
|
||||
)
|
||||
|
||||
func PullCommand() *cli.Command{
|
||||
return &cli.Command {
|
||||
Name: "pull",
|
||||
Usage: "Pull a package",
|
||||
Description: "Pulls a package from the default registry server, or to a user-defined registry server.",
|
||||
HelpName: "pull",
|
||||
Action: func(c *cli.Context) error {
|
||||
//Do Stuff
|
||||
return nil
|
||||
},
|
||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||
if err != nil {
|
||||
fmt.Printf("[ERROR] %s", err.Error())
|
||||
log.Fatal(err)
|
||||
}
|
||||
return err
|
||||
},
|
||||
}
|
||||
}
|
||||
27
Commands/PushCommand.go
Normal file
27
Commands/PushCommand.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package Commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"log"
|
||||
)
|
||||
|
||||
func PushCommand() *cli.Command {
|
||||
return &cli.Command {
|
||||
Name: "push",
|
||||
Usage: "Push a package",
|
||||
Description: "Pushes a package to the default registry server, or to a user-defined registry server.",
|
||||
HelpName: "push",
|
||||
Action: func(c *cli.Context) error {
|
||||
//Do Stuff
|
||||
return nil
|
||||
},
|
||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||
if err != nil{
|
||||
fmt.Printf("[ERROR] %s", err.Error())
|
||||
log.Fatal(err)
|
||||
}
|
||||
return err
|
||||
},
|
||||
}
|
||||
}
|
||||
46
lpm-cli.go
46
lpm-cli.go
|
|
@ -1,56 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"log"
|
||||
"lpm-cli/Commands"
|
||||
"lpm-cli/Informations"
|
||||
"os"
|
||||
"lpm-cli/informations"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func main(){
|
||||
app := &cli.App {
|
||||
Name: "lotus-pm",
|
||||
Usage: "Lotus Package Manager",
|
||||
Authors: informations.GetAuthors(),
|
||||
Name: "lotus-pm",
|
||||
Usage: "Lotus Package Manager",
|
||||
Authors: Informations.GetAuthors(),
|
||||
Copyright: "(c) 2021 LPM-Group",
|
||||
Commands: []*cli.Command {
|
||||
{
|
||||
Name: "push",
|
||||
Usage: "Push a package",
|
||||
Description: "Pushes a package to the default registry server, or to a user-defined registry server.",
|
||||
HelpName: "push",
|
||||
Action: func(c *cli.Context) error {
|
||||
//Do Stuff
|
||||
return nil
|
||||
},
|
||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||
if err != nil{
|
||||
fmt.Printf("[ERROR] %s", err.Error())
|
||||
log.Fatal(err)
|
||||
}
|
||||
return err
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "pull",
|
||||
Usage: "Pull a package",
|
||||
Description: "Pulls a package from the default registry server, or to a user-defined registry server.",
|
||||
HelpName: "pull",
|
||||
Action: func(c *cli.Context) error {
|
||||
//Do Stuff
|
||||
return nil
|
||||
},
|
||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||
if err != nil {
|
||||
fmt.Printf("[ERROR] %s", err.Error())
|
||||
log.Fatal(err)
|
||||
}
|
||||
return err
|
||||
},
|
||||
},
|
||||
Commands.PushCommand(),
|
||||
Commands.PullCommand(),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue