main: quite if missing parameters
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
41a6f0a1e1
commit
485ae194e5
13
main.go
13
main.go
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user