From 3117d704087dec7b8300c106739ce4d0c6f80ea1 Mon Sep 17 00:00:00 2001 From: Cameron Thompson <50184035+iamromulan@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:39:24 -0400 Subject: [PATCH] Update download -Po not supported by busybox grep --- download | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download b/download index 6c733bb..1fde625 100644 --- a/download +++ b/download @@ -91,8 +91,8 @@ download_github_directory() { # Parse and download each file echo "Parsing and downloading files..." echo "$contents" | grep '"type": "file"' | while read -r line; do - file_path=$(echo "$line" | grep -Po '"path": "\K[^"]+') - download_url=$(echo "$line" | grep -Po '"download_url": "\K[^"]+') + file_path=$(echo "$line" | sed -n 's/.*"path": "\([^"]*\)".*/\1/p') + download_url=$(echo "$line" | sed -n 's/.*"download_url": "\([^"]*\)".*/\1/p') if [ -n "$file_path" ] && [ -n "$download_url" ]; then file_name=$(basename "$file_path") @@ -106,7 +106,7 @@ download_github_directory() { # Parse and handle subdirectories echo "Parsing and handling directories..." echo "$contents" | grep '"type": "dir"' | while read -r line; do - sub_dir=$(echo "$line" | grep -Po '"path": "\K[^"]+') + sub_dir=$(echo "$line" | sed -n 's/.*"path": "\([^"]*\)".*/\1/p') if [ -n "$sub_dir" ]; then echo "Recursively handling directory: $sub_dir" download_github_directory "https://github.com/$owner_repo/tree/$branch/$sub_dir" "$output_dir"