Closed medanisjbara closed 1 year ago
I honestly feel like it is a lot more readable without the shfmt
unfortunately.
I ignored the version bump since I only added breaks and moved 2 strings to their separate variables. If anyone thinks a version bump is needed please let me know.
I think a minor bump is adequate, in case your hands slipped once, and it got trough the checks somehow it's good to have a way of narrowing down the search to a single possible file. It just helps with troubleshooting, and I think it's a good practice in general not to have two variants with the same version number.
@port19x The requested changes seem to be upsetting shfmt
. Running it gave me this diff.
--- ani-cli.orig
+++ ani-cli
@@ -36,8 +36,8 @@
[ -n "$line" ] &&
printf "%s" "$stdin" |
grep -E '^'"${line}"'($|\s)' |
- cut -f2,3 \
- || exit 1
+ cut -f2,3 ||
+ exit 1
}
die() {
@@ -120,7 +120,8 @@
# extract the video links from reponse of embed urls, extract mp4 links form m3u8 lists
get_links() {
- episode_link=$(curl -e "https://${allanime_base}" -s \
+ episode_link=$(
+ curl -e "https://${allanime_base}" -s \
--cipher "AES256-SHA256" "https://allanimenews.com$*" \
-A "$agent" |
sed 's|},{|\n|g' |
@@ -135,14 +136,17 @@
sort -nr
;;
*repackager.wixmp.com*)
- extract_link=$(printf "%s" "$episode_link" |
+ extract_link=$(
+ printf "%s" "$episode_link" |
cut -d'>' -f2 |
sed 's|repackager.wixmp.com/||g;s|\.urlset.*||g'
)
- for j in $(printf "%s" "$episode_link" |
+ for j in $(
+ printf "%s" "$episode_link" |
sed -nE 's|.*/,([^/]*),/mp4.*|\1|p' |
sed 's|,|\n|g'
- ); do printf "%s >%s\n" "$j" "$extract_link" |
+ ); do
+ printf "%s >%s\n" "$j" "$extract_link" |
sed "s|,[^/]*|${j}|g"
done | sort -nr
;;
@@ -224,7 +228,8 @@
}
}"
- resp=$(curl -e "https://${allanime_base}" -s \
+ resp=$(
+ curl -e "https://${allanime_base}" -s \
--cipher "AES256-SHA256" \
-G "https://api.${allanime_base}/allanimeapi" \
--data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" \
@port19x I applied the changes you suggested and run shfmt
in a separate commit. You can just ignore/remove that commit if they're to be ignored.
Pull Request
Type of change
Description
I believe splitting long lines into multiple shorter ones is important for readability. And it'll also make patches more readable and maintainable.
Checklist and Testcases
No functional code have been changed, it was just some code beatification. Therefore the checklist and test cases are to be ignored.