Moved Authors to informations package

This commit is contained in:
netbenix 2021-10-30 17:39:01 +02:00
parent 4ed0fe289d
commit c6f415f548
2 changed files with 46 additions and 16 deletions

19
informations/Authors.go Normal file
View file

@ -0,0 +1,19 @@
package informations
import "github.com/urfave/cli/v2"
func GetAuthors() []*cli.Author{
return []*cli.Author {
{
Name: "netbenix",
Email: "netbenix@codenoodles.de",
},
{
Name: "virusbear",
},
{
Name: "maduut",
},
}
}

View file

@ -5,27 +5,18 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"log" "log"
"os" "os"
"lpm-cli/informations"
) )
func main(){ func main(){
app := &cli.App{ app := &cli.App {
Name: "lotus-pm", Name: "lotus-pm",
Usage: "Lotus Package Manager", Usage: "Lotus Package Manager",
Authors: []*cli.Author { Authors: informations.GetAuthors(),
{
Name: "netbenix",
Email: "netbenix@codenoodles.de",
},
{
Name: "virusbear",
},
{
Name: "maduut",
},
},
Copyright: "(c) 2021 LPM-Group", Copyright: "(c) 2021 LPM-Group",
Commands: []*cli.Command{ Commands: []*cli.Command {
{ {
Name: "push", Name: "push",
Usage: "Push a package", Usage: "Push a package",
@ -36,7 +27,27 @@ func main(){
return nil return nil
}, },
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error { OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
fmt.Printf("[ERROR] %s", err.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 return err
}, },
}, },
@ -45,7 +56,7 @@ func main(){
err := app.Run(os.Args) err := app.Run(os.Args)
if err != nil{ if err != nil {
log.Fatal(err) log.Fatal(err)
} }
} }