Add Makefile
parent
b7be2f2bd7
commit
d4a9db23f9
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
bin/xdcc: ./**/*.go
|
||||||
|
go build -o bin/xdcc cmd/main.go
|
||||||
|
|
@ -17,12 +17,12 @@ This project provides a simple command line tool which allow you to perform sear
|
||||||
|
|
||||||
## Installation
|
## 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
|
```bash
|
||||||
git clone https://github.com/ostafen/xdcc-cli.git
|
git clone https://github.com/ostafen/xdcc-cli.git
|
||||||
cd xdcc-cli
|
cd xdcc-cli
|
||||||
go build -o xdcc-cli cmd/main.go
|
make # this will ouput a bin/xdcc executable
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -185,12 +184,12 @@ func execGet(args []string) {
|
||||||
for _, urlStr := range urlList {
|
for _, urlStr := range urlList {
|
||||||
url, err := xdcc.ParseURL(urlStr)
|
url, err := xdcc.ParseURL(urlStr)
|
||||||
if errors.Is(err, xdcc.ErrInvalidURL) {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +210,7 @@ func execGet(args []string) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
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)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +220,7 @@ func main() {
|
||||||
case "get":
|
case "get":
|
||||||
execGet(os.Args[2:])
|
execGet(os.Args[2:])
|
||||||
default:
|
default:
|
||||||
log.Println("no such command: ", os.Args[1])
|
fmt.Println("no such command: ", os.Args[1])
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue