๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere
35
fork

Configure Feed

Select the types of activity you want to include in your feed.

[#16] fix/ignore various shellcheck issues

Ducky e49b687b 20029511

+38 -31
+38 -31
src/shared/util.sh
··· 541 541 for ((i = 0 ; i < $lines ; i++ )); do 542 542 lossy=true 543 543 544 - [[ \"$(atfile.util.get_line "$compressionss" $i)\" == "Lossless" ]] && lossy=false 544 + [[ \"$(atfile.util.get_line "$compressions" $i)\" == "Lossless" ]] && lossy=false 545 545 546 546 output+="{ 547 547 \"bitRate\": $(atfile.util.get_line "$bitRates" $i), ··· 552 552 \"name\": \"$(atfile.util.get_line "$formats" $i)\", 553 553 \"profile\": \"$(atfile.util.get_line "$format_profiles" $i)\" 554 554 }, 555 - \"mode\": \"$(atfile.util.get_line "$bitrate_modes" $i)\", 555 + \"mode\": \"$(atfile.util.get_line "$bitRate_modes" $i)\", 556 556 \"lossy\": $lossy, 557 557 \"sampling\": $(atfile.util.get_line "$samplings" $i), 558 558 \"title\": \"$(atfile.util.get_line "$titles" $i)\" ··· 579 579 lines="$(echo "$bitrates" | wc -l)" 580 580 output="" 581 581 582 - for ((i = 0 ; i < $lines ; i++ )); do 582 + for ((i = 0 ; i < lines ; i++ )); do 583 583 output+="{ 584 584 \"bitRate\": $(atfile.util.get_line "$bitRates" $i), 585 585 \"dimensions\": { ··· 660 660 unset pds_emoji 661 661 662 662 if [[ $pds_host == *".host.bsky.network" ]]; then 663 - bsky_host="$(echo $pds_host | cut -d "." -f 1)" 664 - bsky_region="$(echo $pds_host | cut -d "." -f 2)" 663 + bsky_host="$(echo "$pds_host" | cut -d "." -f 1)" 664 + bsky_region="$(echo "$pds_host" | cut -d "." -f 2)" 665 665 666 666 pds_name="${bsky_host^} ($(atfile.util.get_region_pretty "$bsky_region"))" 667 667 pds_emoji="๐Ÿ„" ··· 671 671 else 672 672 pds_oauth_url="$pds/oauth/authorize" 673 673 pds_oauth_page="$(curl -H "User-Agent: $(atfile.util.get_uas)" -s -L -X GET "$pds_oauth_url")" 674 - pds_customization_data="$(echo $pds_oauth_page | sed -s s/.*_customizationData\"]=//g | sed -s s/\;document\.currentScript\.remove.*//g)" 674 + pds_customization_data="$(echo "$pds_oauth_page" | sed -s s/.*_customizationData\"]=//g | sed -s s/\;document\.currentScript\.remove.*//g)" 675 675 676 676 if [[ $pds_customization_data == "{"* ]]; then 677 - pds_name="$(echo $pds_customization_data | jq -r '.name')" 677 + pds_name="$(echo "$pds_customization_data" | jq -r '.name')" 678 678 pds_emoji="๐ŸŸฆ" 679 679 else 680 680 pds_name="$pds_host" ··· 692 692 path="$1" 693 693 694 694 if [[ $_os == "solaris" ]]; then 695 - # INVESTIGATE: Use this for every OS? 695 + # INVESTIGATE: Use this for every OS? What does this even do? 696 696 [ -d "$path" ] && ( 697 697 cd_path= \cd "$1" 698 698 /bin/pwd 699 699 ) || ( 700 700 cd_path= \cd "$(dirname "$1")" && 701 - printf "%s/%s\n" "$(/bin/pwd)" "$(basename $1)" 701 + printf "%s/%s\n" "$(/bin/pwd)" "$(basename "$1")" 702 702 ) 703 703 else 704 704 realpath "$path" ··· 708 708 function atfile.util.get_region_pretty() { 709 709 region="$1" 710 710 711 - region_sub="$(echo $1 | cut -d "-" -f 2)" 712 - region="$(echo $1 | cut -d "-" -f 1)" 711 + region_sub="$(echo "$region" | cut -d "-" -f 2)" 712 + region="$(echo "$region" | cut -d "-" -f 1)" 713 713 714 714 echo "${region^^} ${region_sub^}" 715 715 } 716 716 717 717 function atfile.util.get_rkey_from_at_uri() { 718 718 at_uri="$1" 719 - echo $at_uri | cut -d "/" -f 5 719 + echo "$at_uri" | cut -d "/" -f 5 720 720 } 721 721 722 722 function atfile.util.get_seconds_since_start() { ··· 733 733 fi 734 734 735 735 if [[ -n $cols ]]; then 736 - echo $cols 736 + echo "$cols" 737 737 else 738 738 echo 80 739 739 fi ··· 747 747 fi 748 748 749 749 if [[ -n $rows ]]; then 750 - echo $rows 750 + echo "$rows" 751 751 else 752 752 echo 30 753 753 fi ··· 775 775 } 776 776 777 777 function atfile.util.get_uas() { 778 + # shellcheck disable=SC2154 778 779 echo "ATFile/$_version" 779 780 } 780 781 ··· 803 804 function atfile.util.get_yn() { 804 805 yn="$1" 805 806 807 + # shellcheck disable=SC2154 806 808 if [[ $_output_json == 0 ]]; then 807 809 if [[ $yn == 0 ]]; then 808 810 echo "No" ··· 828 830 829 831 function atfile.util.is_url_accessible_in_browser() { 830 832 url="$1" 833 + # shellcheck disable=SC2154 831 834 atfile.util.is_url_okay "$url" "$_test_desktop_uas" 832 835 } 833 836 ··· 866 869 unset parsed_uri 867 870 868 871 case $segment in 869 - "host") echo $uri | cut -d "/" -f 3 ;; 870 - "protocol") echo $uri | cut -d ":" -f 1 ;; 871 - *) echo $uri | cut -d "/" -f $segment ;; 872 + "host") echo "$uri" | cut -d "/" -f 3 ;; 873 + "protocol") echo "$uri" | cut -d ":" -f 1 ;; 874 + *) echo "$uri" | cut -d "/" -"f $segme"nt ;; 872 875 esac 873 876 } 874 877 ··· 879 882 unset collection 880 883 unset rkey 881 884 882 - case "$(atfile.util.get_uri_segment $http_uri host)" in 885 + case "$(atfile.util.get_uri_segment "$http_uri" host)" in 883 886 "atproto-browser.vercel.app"|\ 884 887 "pdsls.dev"|\ 885 888 "pdsls.pages.dev") 886 - actor="$(atfile.util.get_uri_segment $http_uri 6)" 887 - collection="$(atfile.util.get_uri_segment $http_uri 7)" 888 - rkey="$(atfile.util.get_uri_segment $http_uri 8)" 889 + actor="$(atfile.util.get_uri_segment "$http_uri" 6)" 890 + collection="$(atfile.util.get_uri_segment "$http_uri" 7)" 891 + rkey="$(atfile.util.get_uri_segment "$http_uri" 8)" 889 892 ;; 890 893 esac 891 894 ··· 912 915 913 916 [[ -z "$_server_original" ]] && _server_original="$_server" 914 917 [[ -z "$_username_original" ]] && _username_original="$_username" 915 - [[ -z "$_fmt_blob_url_original" ]] && _fmt_blob_url_original="$fmt_blob_url" 918 + [[ -z "$_fmt_blob_url_original" ]] && _fmt_blob_url_original="$_fmt_blob_url" 916 919 917 920 resolved_did="$(atfile.util.resolve_identity "$actor")" 918 921 error="$(atfile.util.get_xrpc_error $? "$resolved_did")" 919 922 [[ -n "$error" ]] && atfile.die.xrpc_error "Unable to resolve '$actor'" "$resolved_did" 920 923 921 - _username="$(echo $resolved_did | cut -d "|" -f 1)" 922 - _server="$(echo $resolved_did | cut -d "|" -f 2)" 924 + _username="$(echo "$resolved_did" | cut -d "|" -f 1)" 925 + _server="$(echo "$resolved_did" | cut -d "|" -f 2)" 923 926 927 + # shellcheck disable=SC2154 924 928 if [[ "$_fmt_blob_url" != "$_fmt_blob_url_default" ]]; then 925 929 export _fmt_blob_url="$_fmt_blob_url_default" 926 930 fi ··· 948 952 949 953 function atfile.util.parse_version() { 950 954 version="$1" 951 - version="$(echo $version | cut -d "+" -f 1)" 952 - v_major="$(printf "%04d\n" "$(echo $version | cut -d "." -f 1)")" 953 - v_minor="$(printf "%04d\n" "$(echo $version | cut -d "." -f 2)")" 954 - v_rev="$(printf "%04d\n" "$(echo $version | cut -d "." -f 3)")" 955 + version="$(echo "$version" | cut -d "+" -f 1)" 956 + v_major="$(printf "%04d\n" "$(echo "$version" | cut -d "." -f 1)")" 957 + v_minor="$(printf "%04d\n" "$(echo "$version" | cut -d "." -f 2)")" 958 + v_rev="$(printf "%04d\n" "$(echo "$version" | cut -d "." -f 3)")" 955 959 echo "$(echo ${v_major}${v_minor}${v_rev} | sed 's/^0*//')" 956 960 } 957 961 ··· 979 983 980 984 function atfile.util.print_seconds_since_start_debug() { 981 985 seconds=$(atfile.util.get_seconds_since_start) 982 - second_unit="$(atfile.util.get_int_suffix $seconds "second" "seconds")" 986 + second_unit="$(atfile.util.get_int_suffix "$seconds" "second" "seconds")" 983 987 984 988 atfile.say.debug "$seconds $second_unit since start" 985 989 } ··· 988 992 cursor="$1" 989 993 count="$2" 990 994 991 - if [[ -z $count ]] || (( ( $record_count + $_max_list_buffer ) >= $_max_list )); then 995 + # shellcheck disable=SC2154 996 + if [[ -z $count ]] || (( ( count + _max_list_buffer ) >= _max_list )); then 992 997 first_line="List is limited to $_max_list results. To print more results," 993 998 first_line_length=$(( ${#first_line} + 3 )) 999 + # shellcheck disable=SC2154 994 1000 echo -e "$(atfile.util.repeat_char "-" $first_line_length)\nโ„น๏ธ $first_line\n run \`$_prog $_command $cursor\`" 995 1001 fi 996 1002 } ··· 1000 1006 amount="$2" 1001 1007 1002 1008 if [ -x "$(command -v seq)" ]; then 1003 - printf "%0.s$char" $(seq 1 $amount) 1009 + printf "%0.s$char" $(seq 1 "$amount") 1004 1010 else 1005 1011 echo "$char" 1006 1012 fi ··· 1010 1016 actor="$1" 1011 1017 1012 1018 if [[ "$actor" != "did:"* ]]; then 1019 + # shellcheck disable=SC2154 1013 1020 resolved_handle="$(atfile.xrpc.bsky.get "com.atproto.identity.resolveHandle" "handle=$actor" "" "$_endpoint_resolve_handle")" 1014 1021 error="$(atfile.util.get_xrpc_error $? "$resolved_handle")" 1015 1022