mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-01-18 14:55:38 +00:00
BRANCH_SELECTOR: moved in functions
This commit is contained in:
parent
998818d57c
commit
310324da57
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue