Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ Klient napisany w bashu, pozwalający na wysyłanie wiadomości SMS w serwisie S

```bash
$ ./smsapi sms send --username LOGIN --password PASS 48xxxyyyzzz,48zzzyyyxxx "Hello world"
$ echo Hello world | ./smsapi sms send --username LOGIN --password PASS 48xxxyyyzzz,48zzzyyyxxx
```

```bash
$ ./smsapi
Usage: smsapi sms send [OPTIONS] <to> <message>
Usage: smsapi sms send [OPTIONS] <to> <message> OR echo message | smsapi sms send [OPTIONS] <to>
Options:
--username <string>
--password <password> md5 api password
Expand Down
4 changes: 2 additions & 2 deletions smsapi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ URI="https://ssl.smsapi.pl/api/"

help() {

echo "Usage: smsapi sms send [OPTIONS] <to> <message>"
echo "Usage: smsapi sms send [OPTIONS] <to> <message> OR echo message | smsapi sms send [OPTIONS] <to>"

echo "Options:
--username <string>
Expand Down Expand Up @@ -98,7 +98,7 @@ sms_send() {
params[${#params[@]}]=username=$(rawurlencode "$USERNAME")
params[${#params[@]}]=password=$(rawurlencode "$PASSWORD")
params[${#params[@]}]=to=$(rawurlencode "$1")
params[${#params[@]}]=message=$(rawurlencode "$2")
params[${#params[@]}]=message=$(rawurlencode "${2:-$(cat)}")

if [ ! -z ${OPTIONS[normalize]} ] && [ ${OPTIONS[normalize]} -eq 1 ]; then
params[${#params[@]}]="normalize=1"
Expand Down