Check if url flag is valid

This commit is contained in:
Doc
2024-03-19 12:55:02 +01:00
parent f53cb8367e
commit 806840d947

10
main.go
View File

@@ -3,12 +3,13 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
"strconv"
"strings"
)
func main () {
@@ -23,6 +24,13 @@ func main () {
flag.Parse()
// Check if flags are valid
if *url == "" {
fmt.Println("no thread URL provided")
fmt.Println("use the -u=<Thread URL> flag to provid URL")
os.Exit(1)
}
// Getting the boardname
board := strings.Split(*url, "/")[3]