From f28c5528430ba8d73288c641dd409f12a2c3d2c5 Mon Sep 17 00:00:00 2001 From: pika Date: Wed, 22 May 2024 18:53:07 +0200 Subject: [PATCH] testing.. --- functions/git.fish | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/functions/git.fish b/functions/git.fish index 14952e5..3931802 100644 --- a/functions/git.fish +++ b/functions/git.fish @@ -1,17 +1,30 @@ function gsa +# ─< Prompt the user to enter the repository URL to add as a submodule >──────────────────── echo "-- enter the repository to add as a submodule --" - read repo - echo "-- enter the branch to checkout (main/master..) --" - read branch + read -l repo + +# ─< Prompt the user to enter the branch to checkout (e.g., main, master) >───────────────── + echo "-- enter the branch to checkout (main/master..) --" + read -l branch + +# ─< Prompt the user to enter the relative path where the submodule will be cloned >──────── +# ─< Advise not to use the leading / or ./ >──────────────────────────────────────────────── echo "-- enter the relative path, where the submodule will be cloned to. (don't use fist / or ./) --" - read -S path + read -l path + +# ─< Ask the user for confirmation if the constructed command looks correct >─────────────── echo "-- does this command look right to you? [y/n] --" echo "git submodule add --branch $branch --name $path $repo" -read comm + read -l comm + +# ─< Switch statement to handle the user's confirmation input >───────────────────────────── switch $comm - case [Yy] - git submodule add --branch $branch --name $path $repo - case [Nn] - echo "-- all right, just try again :) --" +# ─< If the user inputs 'y' or 'Y', execute the git submodule add command >───────────────── + case 'y' 'Y' + git submodule add --branch $branch --name $path $repo + +# ─< If the user inputs 'n' or 'N', notify them to try again >────────────────────────────── + case 'n' 'N' + echo "-- all right, just try again :) --" end end