From aca8deb2f21633b209eccf3411cf3b19530a52c5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 9 Nov 2022 00:02:11 -0500 Subject: [PATCH] feat: add git:status subcommand Closes #5248 --- docs/deployment/methods/git.md | 1 + plugins/git/help-functions | 1 + plugins/git/internal-functions | 8 ++++++++ plugins/git/subcommands/status | 6 ++++++ 4 files changed, 16 insertions(+) create mode 100755 plugins/git/subcommands/status diff --git a/docs/deployment/methods/git.md b/docs/deployment/methods/git.md index 5730f14aa..ad34a5098 100644 --- a/docs/deployment/methods/git.md +++ b/docs/deployment/methods/git.md @@ -12,6 +12,7 @@ git:initialize # Initialize a git repository git:public-key # Outputs the dokku public deploy key git:report [] [] # Displays a git report for one or more apps git:set () # Set or clear a git property for an app +git:status # Show the working tree status for an app git:unlock [--force] # Removes previous git clone folder for new deployment ``` diff --git a/plugins/git/help-functions b/plugins/git/help-functions index 577239793..77bee8bd1 100755 --- a/plugins/git/help-functions +++ b/plugins/git/help-functions @@ -37,5 +37,6 @@ fn-help-content() { git:report [] [], Displays a git report for one or more apps git:set (), Set or clear a git property for an app git:unlock [--force], Removes previous git clone folder for new deployment + git:status , show the working tree status for an app help_content } diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index d5177cdb9..d2ae423c0 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -285,6 +285,14 @@ cmd-git-report-single() { fi } +cmd-git-status() { + declare APP="$1" + local APP_ROOT="$DOKKU_ROOT/$APP" + + verify_app_name "$APP" + fn-git-cmd "$APP_ROOT" status +} + fn-git-auth-error() { dokku_log_warn "There is no deploy key associated with the $DOKKU_SYSTEM_USER user." dokku_log_warn "Generate an ssh key with the following command (do not specify a password):" diff --git a/plugins/git/subcommands/status b/plugins/git/subcommands/status new file mode 100755 index 000000000..ea338938b --- /dev/null +++ b/plugins/git/subcommands/status @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +source "$PLUGIN_AVAILABLE_PATH/git/internal-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-git-status "$@"