Skip to content

Commit 138ccd6

Browse files
committed
1.4. See CHANGELOG.md for details.
1 parent 244f3a6 commit 138ccd6

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
### 1.4 - *3/1/2018*
5+
- Error exit code changed from `1` to `4` since codes 1-3 are reserved
6+
- `help` command now returns a successful `0` exit code instead of error
7+
- Added flag to curl `--location` to follow redirects
8+
- User-agent string passed to curl no longer sends `$USER`
9+
- Changes to `README.md`.
10+
- Updated copyright to 2018. Happy New Year!
11+
412
### 1.31 - *1/15/2017*
513
- Changes to `README.md`.
614
- Updated copyright to 2017. Happy New Year!

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Apache License
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2017 NodeSocket, LLC.
189+
Copyright 2018 NodeSocket, LLC.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ Requirements
2323
Installation
2424
------------
2525
````
26-
cd "$HOME"
2726
git clone https://github.com/commando/commando-cli.git
2827
chmod +x commando-cli/commando
2928
````
3029

3130
Optionally, you may create a symbolic link in `/usr/local/bin`:
3231

3332
````
34-
ln -s "$HOME"/commando-cli/commando /usr/local/bin
33+
sudo ln -s commando-cli/commando /usr/local/bin
3534
````
3635

3736
Authentication
@@ -70,7 +69,7 @@ Run An Execution
7069
"id": "usr_9ukjE540e4870aace5VFr",
7170
"ip_address": "198.199.100.1",
7271
"geo_ip": "San Francisco, California, United States",
73-
"user_agent": "Commando-Cli/1.1 demo curl 7.37.1 (x86_64-apple-darwin14.0) libcurl/7.37.1 SecureTransport zlib/1.2.5"
72+
"user_agent": "Commando-Cli/1.4 curl 7.37.1 (x86_64-apple-darwin14.0) libcurl/7.37.1 SecureTransport zlib/1.2.5"
7473
},
7574
"events": [
7675
{
@@ -108,7 +107,7 @@ Create issues here in GitHub (https://github.com/commando/commando-cli/issues).
108107
License & Legal
109108
---------------
110109

111-
Copyright 2017 NodeSocket, LLC.
110+
Copyright 2018 NodeSocket, LLC.
112111

113112
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
114113

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.31
1+
1.4

commando

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# @description The Commando.io command-line interface.
33
#
44
# Commando.io
5-
# Copyright 2017 NodeSocket, LLC.
5+
# Copyright 2018 NodeSocket, LLC.
66
# All rights reserved.
77

88
set -eo pipefail; [[ $TRACE ]] && set -x
99

10-
VERSION="1.31"
10+
VERSION="1.4"
1111

1212
COMMAND=$1
1313
NETRC=~/.netrc
@@ -21,7 +21,7 @@ fi
2121
function check_auth {
2222
if [ ! -e $NETRC ] || ! grep -Fxq "machine $API_ENDPOINT" $NETRC; then
2323
printf "You are not authenticated. To authenticate, run:\n\n\tcommando auth"
24-
exit 1
24+
exit 4
2525
fi
2626
}
2727

@@ -31,9 +31,9 @@ function curl_request() {
3131
CURL_VERSION=$(curl --version | sed -n 1p)
3232

3333
if [ "$2" != "" ]; then
34-
curl --silent --netrc --user-agent "Commando-Cli/$VERSION $USER $CURL_VERSION" "https://$API_ENDPOINT/v1/$1" -X POST --data "$2"
34+
curl --silent --netrc --user-agent --location "Commando-Cli/$VERSION $CURL_VERSION" "https://$API_ENDPOINT/v1/$1" -X POST --data "$2"
3535
else
36-
curl --silent --netrc --user-agent "Commando-Cli/$VERSION $USER $CURL_VERSION" "https://$API_ENDPOINT/v1/$1"
36+
curl --silent --netrc --user-agent --location "Commando-Cli/$VERSION $CURL_VERSION" "https://$API_ENDPOINT/v1/$1"
3737
fi
3838
}
3939

@@ -43,7 +43,7 @@ case "$COMMAND" in
4343
if [ -e $NETRC ] && grep -Fxq "machine $API_ENDPOINT" $NETRC; then
4444
ACCOUNT_ALIAS=$(awk '/$API_ENDPOINT/{getline; print $2}' $NETRC)
4545
printf "You are already authenticated. To unauthenticate, run:\n\n\tcommando unauth"
46-
exit 1
46+
exit 4
4747
fi
4848

4949
read -r -p "Enter your account alias: " ACCOUNT_ALIAS
@@ -117,7 +117,7 @@ EOF
117117

118118
if [ "$RECIPE_ID" == "" ]; then
119119
printf "Missing required argument recipe id.\n\nUsage:\n\tcommando execute <recipe-id> (--server=<server-id> | --groups=<group-id>,<group-id>,...)"
120-
exit 1
120+
exit 4
121121
fi
122122

123123
check_auth
@@ -144,7 +144,7 @@ EOF
144144
curl_request "recipes/$RECIPE_ID/execute" "groups[]=$GROUP"
145145
else
146146
printf "Missing or invalid option.\n\nUsage:\n\tcommando execute <recipe-id> (--server=<server-id> | --groups=<group-id>,<group-id>,...)"
147-
exit 1
147+
exit 4
148148
fi
149149

150150
;;
@@ -155,7 +155,7 @@ EOF
155155

156156
if [ "$EXECUTION_QUEUE_ID" == "" ]; then
157157
printf "Missing required argument execution queue id.\n\nUsage:\n\tcommando execution-queue <execution-queue-id>"
158-
exit 1
158+
exit 4
159159
fi
160160

161161
check_auth
@@ -170,7 +170,7 @@ EOF
170170

171171
if [ "$EXECUTION_ID" == "" ]; then
172172
printf "Missing required argument execution id.\n\nUsage:\n\tcommando executions <execution-id>"
173-
exit 1
173+
exit 4
174174
fi
175175

176176
check_auth
@@ -188,7 +188,11 @@ EOF
188188
*)
189189

190190
printf "Usage:\n\tcommando auth\n\tcommando unauth\n\tcommando servers [<server-id>]\n\tcommando groups [<group-id>]\n\tcommando recipes [<recipe-id>]\n\tcommando execute <recipe-id> (--server=<server-id> | --groups=<group-id>,<group-id>,...)\n\tcommando execution-queue <execution-queue-id>\n\tcommando executions <execution-id>\n\tcommando (version | --version)\n\tcommando (help | --help)"
191-
exit 1
191+
192+
if [ "$COMMAND" != "help" ] && [ "$COMMAND" != "--help" ]; then
193+
exit 4
194+
fi
195+
192196
;;
193197

194198
esac

0 commit comments

Comments
 (0)