From 04c2bcbfd59d56f6c3598aecefd1db463d866c08 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 1 Jan 2024 12:59:09 +0300 Subject: [PATCH] Add JFrog CLI completion to shell profile --- jfrog-oauth/run.sh | 11 +++++++++++ jfrog-token/run.sh | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index dbd9cdc..cf3473b 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -97,3 +97,14 @@ if [ "${CONFIGURE_CODE_SERVER}" == "true" ]; then else echo "🤔 Skipping JFrog extension installation. Set configure_code_server to true to install the JFrog extension." fi + +# Configure the JFrog CLI completion +echo "📦 Configuring JFrog CLI completion..." +jf completion $SHELL --install +# Append the completion script to the shell profile if its bash or zsh if it isn't already there. +if [ "$SHELL" = "/bin/bash" ] || [ "$SHELL" = "/bin/zsh" ]; then + if ! grep -q "source $HOME/.jfrog/jfrog_$${SHELL}_completion" ~/.$${SHELL}rc; then + echo "📦 Adding JFrog CLI completion to shell profile..." + echo "source $HOME/.jfrog/jfrog_$${SHELL}_completion" >> ~/.$${SHELL}rc + fi +fi \ No newline at end of file diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index bac8a7d..ba11550 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -97,3 +97,15 @@ if [ "${CONFIGURE_CODE_SERVER}" == "true" ]; then else echo "🤔 Skipping JFrog extension installation. Set configure_code_server to true to install the JFrog extension." fi + +# Configure the JFrog CLI completion +echo "📦 Configuring JFrog CLI completion..." +jf completion $SHELL --install +# Append the completion script to the shell profile if its bash or zsh if it isn't already there. +if [ "$SHELL" = "/bin/bash" ] || [ "$SHELL" = "/bin/zsh" ]; then + if ! grep -q "source $HOME/.jfrog/jfrog_$${SHELL}_completion" ~/.$${SHELL}rc; then + echo "📦 Adding JFrog CLI completion to shell profile..." + echo "source $HOME/.jfrog/jfrog_$${SHELL}_completion" >> ~/.$${SHELL}rc + fi +fi +