main: quite if missing parameters

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2025-07-16 19:12:22 +03:00
parent 41a6f0a1e1
commit 485ae194e5
Signed by: Hesham
GPG Key ID: 74876157D199B09E

13
main.go
View File

@ -2,23 +2,32 @@ package main
import (
"bufio"
"errors"
"flag"
"fmt"
"gitea.hbanafa.com/hesham/mystc-api/pkg/endpoints"
"gitea.hbanafa.com/hesham/mystc-api/pkg/models"
"os"
"strings"
"gitea.hbanafa.com/hesham/mystc-api/pkg/endpoints"
"gitea.hbanafa.com/hesham/mystc-api/pkg/models"
)
const URL_MYSTC_API_BASE = "https://mystc.stc.com.sa"
const PATH_PHONES_LIST = "/api/mystc-api-authentication/phones-list"
var ErrMissingFlags = errors.New("flag: missing required flags. use -h")
func main() {
id := flag.String("id", "", "National ID or Iqama")
pw := flag.String("password", "", "MySTC Password")
flag.Parse()
if *id == "" || *pw == "" {
fmt.Fprintf(os.Stderr, "%s\n", ErrMissingFlags.Error())
os.Exit(1)
}
phones, err := endpoints.GetPhonesList(*id, *pw)
if err != nil {
fmt.Println(err.Error())