-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Mixed args module | ||
|
||
This module is used solely for running automated tests against the Gruntwork Installer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# A dirt simple install script that expects one madatory argument, --message-to-echo, that it echoes. The echo message can be overridden with | ||
# a flag, --echo-override. This is used to test that the --module-param args in gruntwork-install can handle flags without values. | ||
|
||
set -e | ||
|
||
function assert_not_empty { | ||
local -r arg_name="$1" | ||
local -r arg_value="$2" | ||
|
||
if [[ -z "$arg_value" ]]; then | ||
echo "ERROR: The value for '$arg_name' cannot be empty" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function install { | ||
local echomessage | ||
|
||
while [[ $# > 0 ]]; do | ||
local key="$1" | ||
|
||
case "$key" in | ||
--message-to-echo) | ||
echomessage="$2" | ||
shift | ||
;; | ||
--echo-override) | ||
echomessage="Override" | ||
;; | ||
*) | ||
echo "Unrecognized argument: $key" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
shift | ||
done | ||
|
||
assert_not_empty "--message-to-echo" "$echomessage" | ||
echo "$echomessage" | ||
} | ||
|
||
install "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters