Browse Source

new: actually prints help and version with corresponding master options.

raw-remaining-args
Valentin Lab 8 years ago
parent
commit
2256c294ba
  1. 48
      bin/compose

48
bin/compose

@ -38,6 +38,42 @@ include parse
depends shyaml docker
version=0.1
usage="$exname [COMPOSE_OPTS] [ACTION [ACTION_OPTS]]"
help="\
$WHITE$exname$NORMAL jobs is to run various shell scripts to build
a running orchestrated and configured docker containers. These shell
scripts will have the opportunity to build a 'docker-compose.yml'.
Once init script and relations scripts are executed, $WHITE$exname$NORMAL
delegate the launching to ${WHITE}docker-compose${NORMAL} by providing it
the final 'docker-compose.yml'.
$WHITE$exname$NORMAL also leverage charms to offer some additional custom
actions per charm, which are simply other scripts that can be
run without launching ${WHITE}docker-compose${NORMAL}.
In compose message, color coding is enforced as such:
- ${DARKCYAN}action$NORMAL,
- ${DARKBLUE}relation$NORMAL,
- ${DARKYELLOW}charm${NORMAL}/${DARKYELLOW}service${NORMAL},
- ${WHITE}option-name${NORMAL}/${WHITE}command-name${NORMAL}/${WHITE}Section-Title${NORMAL}
$WHITE$exname$NORMAL reads '/etc/compose.conf' for global variables, and
'/etc/compose.local.conf' for local host adjustements.
${WHITE}$exname Options${NORMAL}:
-h, --help Print this message and quit
(ignoring any other options)
-V, --version Print current version and quit
(ignoring any other options)
-v, --verbose Be more verbose
-d, --debug Print full debugging information (sets also verbose)
"
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=true
@ -1991,11 +2027,15 @@ while [ "$#" != 0 ]; do
case "$1" in
--help|-h)
no_init=true ; no_hooks=true ; no_relations=true
compose_opts+=("$1")
print_help
exit 0
;;
--verbose|-v)
export VERBOSE=true
compose_opts+=("$1")
;;
--version|-V)
print_version
exit 0
;;
-f)
[ -e "$2" ] || die "File $2 doesn't exists"
@ -2068,7 +2108,7 @@ while [ "$#" != 0 ]; do
done
[ "${compose_opts[*]}" ] && debug "Main docker-compose opts: ${compose_opts[*]}"
[ "${action_opts[*]}" ] && debug "Action '$action' opts: ${action_opts[*]}"
[ "${action_opts[*]}" ] && debug "Action $DARKCYAN$action$NORMAL with opts: ${action_opts[*]}"
[ "${remainder_args[*]}" ] && debug "Remainder args: ${remainder_args[*]}"
@ -2081,7 +2121,7 @@ export DOCKER_DATASTORE=${DOCKER_DATASTORE:-/srv/docker-datastore}
COMPOSE_YML_FILE=$(get_compose_yml_location) || exit 1
export COMPOSE_YML_FILE
debug "Found 'compose.yml' file in '$COMPOSE_YML_FILE'."
debug "Found $WHITE$exname$NORMAL YAML file in '$COMPOSE_YML_FILE'."
output=$(shyaml get-value < "$COMPOSE_YML_FILE" 2>&1)
if [ "$?" != 0 ]; then

Loading…
Cancel
Save