From d4a9db23f9444da07969606fbf566e6846984721 Mon Sep 17 00:00:00 2001 From: Stefano Scafiti Date: Mon, 17 Apr 2023 15:01:59 +0200 Subject: [PATCH] Add Makefile --- Makefile | 3 +++ README.md | 4 ++-- cmd/main.go | 9 ++++----- 3 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..23ee40a --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ + +bin/xdcc: ./**/*.go + go build -o bin/xdcc cmd/main.go \ No newline at end of file diff --git a/README.md b/README.md index e7ab7b7..06450cb 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,12 @@ This project provides a simple command line tool which allow you to perform sear ## Installation -Assuming you have the latest version of Go installed on your system, you can use the **buid** command to get an executable: +Assuming you have the latest version of Go installed on your system, you can use the **make** command to build an executable: ```bash git clone https://github.com/ostafen/xdcc-cli.git cd xdcc-cli -go build -o xdcc-cli cmd/main.go +make # this will ouput a bin/xdcc executable ``` ## Usage diff --git a/cmd/main.go b/cmd/main.go index 78c5436..37814ac 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -6,7 +6,6 @@ import ( "errors" "flag" "fmt" - "log" "os" "strconv" "strings" @@ -185,12 +184,12 @@ func execGet(args []string) { for _, urlStr := range urlList { url, err := xdcc.ParseURL(urlStr) if errors.Is(err, xdcc.ErrInvalidURL) { - log.Printf("no valid irc url: %s\n", urlStr) + fmt.Printf("no valid irc url: %s\n", urlStr) continue } if err != nil { - log.Println(err.Error()) + fmt.Println(err.Error()) os.Exit(1) } @@ -211,7 +210,7 @@ func execGet(args []string) { func main() { if len(os.Args) < 2 { - log.Println("one of the following subcommands is expected: [search, get]") + fmt.Println("one of the following subcommands is expected: [search, get]") os.Exit(1) } @@ -221,7 +220,7 @@ func main() { case "get": execGet(os.Args[2:]) default: - log.Println("no such command: ", os.Args[1]) + fmt.Println("no such command: ", os.Args[1]) os.Exit(1) } }