about summary refs log tree commit diff stats
path: root/hm
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-01-06 21:33:01 +0100
committerSoispha <soispha@vhack.eu>2024-01-06 21:33:01 +0100
commitae777ec23f62ee25348c74c3893d27c849904496 (patch)
tree5cce800d11f5011e815b9b483574a8763dae0e73 /hm
parentdocs(hm/pkgs/scr/specific/ytcc/yts): Add a help text (diff)
downloadnixos-config-ae777ec23f62ee25348c74c3893d27c849904496.tar.gz
nixos-config-ae777ec23f62ee25348c74c3893d27c849904496.zip
fix(hm/pkgs/scr/specific/ytcc/yts): Add default ordering mode
Diffstat (limited to 'hm')
-rwxr-xr-xhm/soispha/pkgs/scripts/specific/ytcc/yts4
1 files changed, 4 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts/specific/ytcc/yts b/hm/soispha/pkgs/scripts/specific/ytcc/yts
index d3508bba..390cc0f5 100755
--- a/hm/soispha/pkgs/scripts/specific/ytcc/yts
+++ b/hm/soispha/pkgs/scripts/specific/ytcc/yts
@@ -67,6 +67,7 @@ case "$1" in
         case "$1" in
             "date")
                     set -- "--order-by" "publish_date" "desc"
+                    oder_mode_set=true;
                 ;;
             "raw")
                 shift 1;
@@ -74,6 +75,7 @@ case "$1" in
                     [ -z "$2" ] && die "A first argument to 'order raw' requires a second"
                     set -- "--order-by" "$1" "$2"
                 fi
+                oder_mode_set=true;
                 ;;
             *)
                 die "'$1' is not a valid subcommand for 'order'; See '--help' for a list";
@@ -85,6 +87,8 @@ case "$1" in
         ;;
 esac
 
+# Set the default ordering mode
+[ -z "$oder_mode_set" ] && set -- "--order-by" "publish_date" "desc"
 
 table="$(ytcc --output json list "$@" | jq --raw-output 'map("pick \(.id) \(.title) (\(.playlists | map(.name) | join(", "))) [\(.duration | gsub("^\\s+|\\s+$";""))]") | join("\n")')"