Updated logger calls
This commit is contained in:
parent
8e885dd555
commit
1bd48b980f
4 changed files with 13 additions and 11 deletions
|
|
@ -3,14 +3,14 @@ package Commands
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"log"
|
"lpm-cli/Tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PullCommand() *cli.Command{
|
func PullCommand() *cli.Command{
|
||||||
return &cli.Command {
|
return &cli.Command {
|
||||||
Name: "pull",
|
Name: "pull",
|
||||||
Usage: "Pull a package",
|
Usage: "Pull a package",
|
||||||
Description: "Pulls a package from the default registry server, or to a user-defined registry server.",
|
Description: "Pulls a package from the a registry server.",
|
||||||
HelpName: "pull",
|
HelpName: "pull",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
//Do Stuff
|
//Do Stuff
|
||||||
|
|
@ -19,7 +19,7 @@ func PullCommand() *cli.Command{
|
||||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[ERROR] %s", err.Error())
|
fmt.Printf("[ERROR] %s", err.Error())
|
||||||
log.Fatal(err)
|
Tools.ErrorLogger.Fatal(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package Commands
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"log"
|
"lpm-cli/Tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PushCommand() *cli.Command {
|
func PushCommand() *cli.Command {
|
||||||
|
|
@ -19,7 +19,7 @@ func PushCommand() *cli.Command {
|
||||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||||
if err != nil{
|
if err != nil{
|
||||||
fmt.Printf("[ERROR] %s", err.Error())
|
fmt.Printf("[ERROR] %s", err.Error())
|
||||||
log.Fatal(err)
|
Tools.ErrorLogger.Fatal(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package Commands
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"log"
|
"lpm-cli/Tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SearchCommand() *cli.Command{
|
func SearchCommand() *cli.Command{
|
||||||
|
|
@ -19,7 +19,7 @@ func SearchCommand() *cli.Command{
|
||||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[ERROR]%s", err.Error())
|
fmt.Printf("[ERROR]%s", err.Error())
|
||||||
log.Fatal(err)
|
Tools.ErrorLogger.Fatal(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
|
|
|
||||||
10
lpm-cli.go
10
lpm-cli.go
|
|
@ -2,15 +2,17 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"log"
|
|
||||||
"lpm-cli/Commands"
|
"lpm-cli/Commands"
|
||||||
"lpm-cli/Informations"
|
"lpm-cli/Informations"
|
||||||
|
"lpm-cli/Tools"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
Tools.LoggerInit()
|
||||||
|
|
||||||
func main(){
|
Tools.InfoLogger.Printf("Lotus-PM was executed")
|
||||||
app := &cli.App {
|
app := &cli.App {
|
||||||
Name: "lotus-pm",
|
Name: "lotus-pm",
|
||||||
Usage: "Lotus Package Manager",
|
Usage: "Lotus Package Manager",
|
||||||
|
|
@ -20,12 +22,12 @@ func main(){
|
||||||
Commands.PushCommand(),
|
Commands.PushCommand(),
|
||||||
Commands.PullCommand(),
|
Commands.PullCommand(),
|
||||||
Commands.SearchCommand(),
|
Commands.SearchCommand(),
|
||||||
|
Commands.ListCommand(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
err := app.Run(os.Args)
|
err := app.Run(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
Tools.ErrorLogger.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in a new issue