Add Makefile

main
Stefano Scafiti 2023-04-17 15:01:59 +02:00
parent b7be2f2bd7
commit d4a9db23f9
3 changed files with 9 additions and 7 deletions

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
bin/xdcc: ./**/*.go
go build -o bin/xdcc cmd/main.go

View File

@ -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

View File

@ -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)
}
}