From 831b4aeb97304903874b96989ff7bda29c8d49a0 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 20 Feb 2024 09:13:45 +0100 Subject: [PATCH] BRANCH_SELECTOR: added a new branch selector --- functions/branch_selection.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 functions/branch_selection.sh diff --git a/functions/branch_selection.sh b/functions/branch_selection.sh new file mode 100755 index 00000000..375fe74e --- /dev/null +++ b/functions/branch_selection.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Fetch branches from GitHub API +branches=$(curl -s https://api.github.com/repos/XargonWan/RetroDECK/branches | grep '"name":' | awk -F '"' '{print $4}') + +# Create an array to store branch names +branch_array=() + +# Loop through each branch and add it to the array +while IFS= read -r branch; do + branch_array+=("$branch") +done <<< "$branches" + +# Display branches in a Zenity list dialog +selected_branch=$(zenity --list --title="Select Branch" --column="Branch" "${branch_array[@]}") + +# Output selected branch +echo "Selected branch: $selected_branch" \ No newline at end of file