Compare commits

...

4 Commits
1.4.5 ... 1.4.7

Author SHA1 Message Date
Jose Diaz-Gonzalez
c9ea129035 Release 1.4.7 2018-10-10 23:54:38 -04:00
Jose Diaz-Gonzalez
00b290346e feat: allow removal of header from :list subcommand 2018-10-10 23:54:08 -04:00
Jose Diaz-Gonzalez
d40e5bbb35 Release 1.4.6 2018-10-10 23:48:44 -04:00
Jose Diaz-Gonzalez
4689d223b6 fix: respect various ways of not wanting 'fancy' output.
Closes dokku/dokku-daemon#19
Closes dokku/dokku-daemon#22
2018-10-10 23:47:46 -04:00
3 changed files with 49 additions and 25 deletions

View File

@@ -440,7 +440,11 @@ service_list() {
if [[ -z $SERVICES ]]; then if [[ -z $SERVICES ]]; then
dokku_log_warn "There are no $PLUGIN_SERVICE services" dokku_log_warn "There are no $PLUGIN_SERVICE services"
else else
LIST=""
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
LIST="NAME,VERSION,STATUS,EXPOSED PORTS,LINKS\n" LIST="NAME,VERSION,STATUS,EXPOSED PORTS,LINKS\n"
fi
for SERVICE in $SERVICES; do for SERVICE in $SERVICES; do
LIST+="$SERVICE,$(service_version "$SERVICE"),$(service_status "$SERVICE"),$(service_exposed_ports "$SERVICE"),$(service_linked_apps "$SERVICE")\n" LIST+="$SERVICE,$(service_version "$SERVICE"),$(service_status "$SERVICE"),$(service_exposed_ports "$SERVICE"),$(service_linked_apps "$SERVICE")\n"
done done

View File

@@ -32,10 +32,10 @@ fn-help-all() {
FULL_OUTPUT=true FULL_OUTPUT=true
if [[ "$CMD" = "$PLUGIN_COMMAND_PREFIX:help" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX:default" ]] ; then if [[ "$CMD" = "$PLUGIN_COMMAND_PREFIX:help" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX" ]] || [[ "$CMD" == "$PLUGIN_COMMAND_PREFIX:default" ]] ; then
BOLD="$(tput bold)" BOLD="$(fn-help-fancy-tput bold)"
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
BLUE="\033[0;34m" BLUE="$(fn-help-fancy-color "\033[0;34m")"
CYAN="\033[1;36m" CYAN="$(fn-help-fancy-color "\033[1;36m")"
if [[ -n "$SUBCOMMAND" ]] && [[ "$SUBCOMMAND" != "--all" ]]; then if [[ -n "$SUBCOMMAND" ]] && [[ "$SUBCOMMAND" != "--all" ]]; then
fn-help-contents-subcommand "$SUBCOMMAND" "$FULL_OUTPUT" fn-help-contents-subcommand "$SUBCOMMAND" "$FULL_OUTPUT"
return "$?" return "$?"
@@ -95,12 +95,12 @@ fn-help-contents-subcommand() {
desc="$(grep desc "$CLEAN_FILE" | head -1)" desc="$(grep desc "$CLEAN_FILE" | head -1)"
eval "$desc" eval "$desc"
BLUE="\033[0;34m" BLUE="$(fn-help-fancy-color "\033[0;34m")"
BOLD="$(tput bold)" BOLD="$(fn-help-fancy-tput bold)"
CYAN="\033[1;36m" CYAN="$(fn-help-fancy-color "\033[1;36m")"
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
LIGHT_GRAY="\033[2;37m" LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
LIGHT_RED="\033[1;31m" LIGHT_RED="$(fn-help-fancy-color "\033[1;31m")"
CMD_OUTPUT="$(echo -e " ${PLUGIN_COMMAND_PREFIX}${cmd_line}, ${LIGHT_GRAY}${desc}${NORMAL}")" CMD_OUTPUT="$(echo -e " ${PLUGIN_COMMAND_PREFIX}${cmd_line}, ${LIGHT_GRAY}${desc}${NORMAL}")"
if [[ "$FULL_OUTPUT" != "true" ]]; then if [[ "$FULL_OUTPUT" != "true" ]]; then
echo "$CMD_OUTPUT" echo "$CMD_OUTPUT"
@@ -139,6 +139,26 @@ fn-help-contents-subcommand() {
return 0 return 0
} }
fn-help-fancy-tput() {
declare desc="A wrapper around tput"
if [[ -z "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
return
fi
tput "$@"
}
fn-help-fancy-color() {
declare desc="A wrapper around colors"
if [[ -z "$DOKKU_NO_COLOR" ]] || [[ "$TERM" = "unknown" ]] || [[ "$TERM" == "dumb" ]]; then
return
fi
echo "$@"
}
fn-help-list-example() { fn-help-list-example() {
# shellcheck disable=SC2034 # shellcheck disable=SC2034
declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content" declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content"
@@ -153,8 +173,8 @@ fn-help-subcommand-args() {
local argline arglist args argpos BLUE NORMAL local argline arglist args argpos BLUE NORMAL
if [[ "$FULL_OUTPUT" == "true" ]]; then if [[ "$FULL_OUTPUT" == "true" ]]; then
BLUE="\033[0;34m" BLUE="$(fn-help-fancy-color "\033[0;34m")"
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
fi fi
argline=$(grep declare "$FUNC_FILE" | grep -v "declare desc" | head -1 || true) argline=$(grep declare "$FUNC_FILE" | grep -v "declare desc" | head -1 || true)
arglist=($(echo -e "${argline// /"\n"}" | awk -F= '/=/{print ""$1""}')) arglist=($(echo -e "${argline// /"\n"}" | awk -F= '/=/{print ""$1""}'))
@@ -199,12 +219,12 @@ fn-help-subcommand-example() {
return 0 return 0
fi fi
BOLD="$(tput bold)" BOLD="$(fn-help-fancy-tput bold)"
LAST_LINE="" LAST_LINE=""
LIGHT_GRAY="\033[2;37m" LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
OTHER_GRAY="\033[7;37m" OTHER_GRAY="$(fn-help-fancy-color "\033[7;37m")"
NEWLINE="" NEWLINE=""
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
_fn-help-apply-shell-expansion "$EXAMPLE" | while read -r line; do _fn-help-apply-shell-expansion "$EXAMPLE" | while read -r line; do
line="$(echo "$line" | cut -c 4-)" line="$(echo "$line" | cut -c 4-)"
if [[ "$line" == export* ]] || [[ "$line" == dokku* ]]; then if [[ "$line" == export* ]] || [[ "$line" == dokku* ]]; then
@@ -234,8 +254,8 @@ fn-help-subcommand-list-args() {
return 0 return 0
fi fi
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
LIGHT_GRAY="\033[2;37m" LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do _fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}" echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"
@@ -251,8 +271,8 @@ fn-help-subcommand-list-flags() {
return 0 return 0
fi fi
NORMAL="\033[m" NORMAL="$(fn-help-fancy-color "\033[m")"
LIGHT_GRAY="\033[2;37m" LIGHT_GRAY="$(fn-help-fancy-color "\033[2;37m")"
_fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do _fn-help-apply-shell-expansion "$FLAGS" | while read -r line; do
echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}" echo -e "$(echo "$line" | cut -d',' -f1),${LIGHT_GRAY}$(echo "$line" | cut -d',' -f2-)${NORMAL}"

View File

@@ -1,4 +1,4 @@
[plugin] [plugin]
description = "dokku mysql service plugin" description = "dokku mysql service plugin"
version = "1.4.5" version = "1.4.7"
[plugin.config] [plugin.config]