From c6f415f5481aeacd919ad98fc37bf3e801a192d5 Mon Sep 17 00:00:00 2001 From: netbenix Date: Sat, 30 Oct 2021 17:39:01 +0200 Subject: [PATCH] Moved Authors to informations package --- informations/Authors.go | 19 ++++++++++++++++++ lpm-cli.go | 43 ++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 informations/Authors.go diff --git a/informations/Authors.go b/informations/Authors.go new file mode 100644 index 0000000..cfbe234 --- /dev/null +++ b/informations/Authors.go @@ -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", + }, + } +} + diff --git a/lpm-cli.go b/lpm-cli.go index da11319..4a0f284 100644 --- a/lpm-cli.go +++ b/lpm-cli.go @@ -5,27 +5,18 @@ import ( "github.com/urfave/cli/v2" "log" "os" + "lpm-cli/informations" ) + func main(){ - app := &cli.App{ + app := &cli.App { Name: "lotus-pm", Usage: "Lotus Package Manager", - Authors: []*cli.Author { - { - Name: "netbenix", - Email: "netbenix@codenoodles.de", - }, - { - Name: "virusbear", - }, - { - Name: "maduut", - }, - }, + Authors: informations.GetAuthors(), Copyright: "(c) 2021 LPM-Group", - Commands: []*cli.Command{ + Commands: []*cli.Command { { Name: "push", Usage: "Push a package", @@ -36,7 +27,27 @@ func main(){ return nil }, 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 }, }, @@ -45,7 +56,7 @@ func main(){ err := app.Run(os.Args) - if err != nil{ + if err != nil { log.Fatal(err) } } \ No newline at end of file