12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package main
- import (
- "os"
- "fmt"
- "github.com/pborman/getopt"
- api "devel.mephi.ru/dyokunev/go-ssms.su/ssmsSuApi"
- )
- func main() {
- var err error
- var login string
- var password string
- var recipient string
- var message string
- var senderName string
- getopt.StringVar(&login, 'l', "login" )
- getopt.StringVar(&password, 'p', "password" )
- getopt.StringVar(&recipient, 't', "recipient" )
- getopt.StringVar(&message, 'm', "message" )
- getopt.StringVar(&senderName, 'f', "sender-name" )
- getopt.Parse()
- if (getopt.NArgs() > 0) {
- getopt.Usage()
- os.Exit(-2)
- }
- if (login == "" || password == "" || recipient == "" || message == "") {
- getopt.Usage()
- os.Exit(-2)
- }
- err, r := api.SendSms(login, password, recipient, message, senderName)
- if (err != nil) {
- fmt.Printf("Cannot send the SMS: %v\n", err.Error())
- os.Exit(-1)
- }
- fmt.Printf("Error: %v; Response: %v\n", err, r);
- os.Exit(0);
- }
|