From 310324da57014534f39bdcb02a188138ee5dba8b Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 20 Feb 2024 09:43:21 +0100 Subject: [PATCH] BRANCH_SELECTOR: moved in functions --- functions/branch_selection.sh | 30 ------------------------------ functions/functions.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 30 deletions(-) delete mode 100755 functions/branch_selection.sh diff --git a/functions/branch_selection.sh b/functions/branch_selection.sh deleted file mode 100755 index d56534a0..00000000 --- a/functions/branch_selection.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Fetch branches from GitHub API excluding "main" -branches=$(curl -s https://api.github.com/repos/XargonWan/RetroDECK/branches | grep '"name":' | awk -F '"' '$4 != "main" {print $4}') -# TODO: logging - Fetching branches from GitHub API - -# 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" -# TODO: logging - Creating array of branch names - -# Display branches in a Zenity list dialog -selected_branch=$(zenity --list --title="Select Branch" --column="Branch" --width=1280 --height=800 "${branch_array[@]}") -# TODO: logging - Displaying branches in Zenity list dialog - -# Display warning message -if [ $selected_branch ]; then - zenity --question --text="Are you sure you want to move to \"$selected_branch\" branch?" - # Output selected branch - echo "Selected branch: $selected_branch" # TODO: logging - Outputting selected branch - zenity --info --text="The data will be now downloaded, please stand by." - # Do stuff here -else - zenity --warning --text="No branch selected, exiting." - # TODO: logging -fi diff --git a/functions/functions.sh b/functions/functions.sh index a03d1e35..16f27d3f 100644 --- a/functions/functions.sh +++ b/functions/functions.sh @@ -562,6 +562,37 @@ easter_eggs() { cp -f "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen } +branch_selector() { + # Fetch branches from GitHub API excluding "main" + branches=$(curl -s https://api.github.com/repos/XargonWan/RetroDECK/branches | grep '"name":' | awk -F '"' '$4 != "main" {print $4}') + # TODO: logging - Fetching branches from GitHub API + + # 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" + # TODO: logging - Creating array of branch names + + # Display branches in a Zenity list dialog + selected_branch=$(zenity --list --title="Select Branch" --column="Branch" --width=1280 --height=800 "${branch_array[@]}") + # TODO: logging - Displaying branches in Zenity list dialog + + # Display warning message + if [ $selected_branch ]; then + zenity --question --text="Are you sure you want to move to \"$selected_branch\" branch?" + # Output selected branch + echo "Selected branch: $selected_branch" # TODO: logging - Outputting selected branch + zenity --info --text="The data will be now downloaded, please stand by." + # Do stuff here + else + zenity --warning --text="No branch selected, exiting." + # TODO: logging + fi +} + quit_retrodeck() { pkill -f retrodeck pkill -f emulationstation