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 ( import (
"encoding/json" "encoding/json"
"flag" "flag"
"fmt"
"io" "io"
"log" "log"
"net/http" "net/http"
"os" "os"
"strings"
"strconv" "strconv"
"strings"
) )
func main () { func main () {
@@ -23,6 +24,13 @@ func main () {
flag.Parse() 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 // Getting the boardname
board := strings.Split(*url, "/")[3] board := strings.Split(*url, "/")[3]