Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 66620fb

Browse files
dmiusDmitry
authored andcommitted
nancy-cli fix + tests
1 parent a626b27 commit 66620fb

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

nancy.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ case "$1" in
3030
exit 1;
3131
;;
3232
* )
33-
if [ ! -f "./nancy_$1.sh" ]
33+
if [ ! -f "${BASH_SOURCE%/*}/nancy_$1.sh" ]
3434
then
3535
>&2 echo "ERROR: Unknown command."
3636
exit 1;
3737
fi
38-
cmd="./nancy_$1.sh"
38+
cmd="${BASH_SOURCE%/*}/nancy_$1.sh"
39+
shift;
3940
;;
4041
esac
4142

@@ -45,5 +46,7 @@ do
4546
shift
4647
done
4748

49+
echo "CMD: $cmd"
50+
4851
${cmd}
4952

tests/nancy_cli_run_no_optons.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
output=$(${BASH_SOURCE%/*}/../nancy.sh run --run-on aws 2>&1)
4+
5+
if [[ $output =~ "ERROR: AWS keys not given" ]]; then
6+
echo -e "\e[36mOK\e[39m"
7+
else
8+
>&2 echo -e "\e[31mFAILED\e[39m"
9+
exit 1
10+
fi

tests/nancy_cli_unknown.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
output=$(${BASH_SOURCE%/*}/../nancy.sh init --run-on aws 2>&1)
4+
5+
if [[ $output =~ "ERROR: Unknown command" ]]; then
6+
echo -e "\e[36mOK\e[39m"
7+
else
8+
>&2 echo -e "\e[31mFAILED\e[39m"
9+
exit 1
10+
fi

0 commit comments

Comments
 (0)