diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-07-22 10:35:51 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-07-22 10:44:04 +0530 |
| commit | d40ab7a488e0b53b9541652e588b62879bc69bba (patch) | |
| tree | f73227d9117773969828ce43d30d4de5934e14c6 /cgit/ssh/git-shell-commands/_utils/input.sh | |
| parent | 4c142d2a977a2c377ea3bef30fa986010056ba3e (diff) | |
| download | bacchus-remote-main.tar.gz bacchus-remote-main.zip | |
Diffstat (limited to 'cgit/ssh/git-shell-commands/_utils/input.sh')
| -rw-r--r-- | cgit/ssh/git-shell-commands/_utils/input.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cgit/ssh/git-shell-commands/_utils/input.sh b/cgit/ssh/git-shell-commands/_utils/input.sh new file mode 100644 index 0000000..d8842ba --- /dev/null +++ b/cgit/ssh/git-shell-commands/_utils/input.sh @@ -0,0 +1,27 @@ + +input_repo_name() { + repo_name="$(gum input --header "Repo name (alphanumeric + hyphen/dashes)")" + [ -z "$repo_name" ] && echo "Error: empty repo name" 1>&2 && exit 1 + (echo "$repo_name" | grep -q "^[A-Za-z0-9_-]\+$" 2>/dev/null) || (echo "Error: invalid repo name" 1>&2 && exit 1) + echo "$repo_name" +} + +input_repo_description() { + description="$( (cat "$1/description" 2>/dev/null || true) | gum write --header "Repo description")" + [ -z "$description" ] && echo "Error: empty description" 1>&2 && exit 1 + echo "$description" +} + +input_repo_remote_url() { + remote_repo_url="$(gum input --header "Repo url")"; + [ -z "$remote_repo_url" ] && echo "Error: empty repo url" 1>&2 && exit 1 + echo "$remote_repo_url" +} + +select_repo_name() { + ls -1 /git | gum choose --header "Repo" +} + +input_repo_category() { + (git -C "$1" config get gitweb.category 2>/dev/null || true) | gum input --header "Category" +} |
