Skip to content

Commit

Permalink
show cluster required error if no args
Browse files Browse the repository at this point in the history
  • Loading branch information
kzap committed Apr 30, 2016
1 parent 01ee47c commit 7af49bf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
42 changes: 42 additions & 0 deletions bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,47 @@ update() {
&& log "updated $VERSION -> `./bin/deploy --version`"
}

#
# Output sample config
#
# parse argv
mkconfig() {
local user="ssh-user"
local host="server-host"
local repo="git-repo-url"
local path="remote-path"
local ref
local post_deploy
local config_name="CONFIG-NAME"

while test $# -ne 0; do
arg=$1; shift
case $arg in
-u|--user) test -n "$1" && user=$1 ;;
-h|--host) test -n "$1" && host=$1 ;;
--repo) test -n "$1" && repo=$1 ;;
--path) test -n "$1" && path=$1 ;;
--ref) test -n "$1" && ref=$1 ;;
--post-deploy) test -n "$1" && post_deploy=$1 ;;
*)
if test -z "$config_name"; then
config_name=$arg;
fi
;;
esac
done

echo <<-EOF
[$config_name]
user=${user}
host=$host
repo=$repo
path=$path
ref=$ref
post_deploy=$post_deploy
EOF
}

# parse argv

while test $# -ne 0; do
Expand All @@ -356,6 +397,7 @@ while test $# -ne 0; do
list) require_env; list_deploys; exit ;;
update) update; exit ;;
config) config $@; exit ;;
mkconfig) mkconfig $@; exit ;;
*)
if test -z "$ENV"; then
ENV=$arg;
Expand Down
3 changes: 3 additions & 0 deletions bin/deploy-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,11 @@ while test $# -ne 0; do
else
require_cluster
run_deploy_cluster $@;
exit;
fi
;;
esac
done

require_cluster

0 comments on commit 7af49bf

Please sign in to comment.