all repos — nixfiles @ 50bbd00de6fde11f1f2eceba08ccb2029e960114

System and user configuration, managed by nix and home-manager

fish: fix newest/oldest with POSIX `cut`
Alan Pearce alan@alanpearce.eu
Fri, 17 May 2024 11:31:52 +0200
commit

50bbd00de6fde11f1f2eceba08ccb2029e960114

parent

b76008ec6b5f50ee06e636ada50a71076a822cf5

2 files changed, 6 insertions(+), 6 deletions(-)

jump to
M user/settings/fish/functions/newest.fishuser/settings/fish/functions/newest.fish
@@ -5,8 +5,8 @@ return 1     end
     for arg in $argv
         fd --hidden --print0 --max-depth 1 . $arg |
-            bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TR %TF %h/%f\0' \) |
-            sort --zero-terminated --reverse --key 1n,1 | head --zero-terminated --lines 1 |
-            cut --delimiter ' ' --fields 2,3
+            bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TR %TF %h/%f\n' \) |
+            sort --reverse --key 1n,1 | head --lines 1 |
+            cut -d ' ' -f 2,3
     end
 end
M user/settings/fish/functions/oldest.fishuser/settings/fish/functions/oldest.fish
@@ -5,8 +5,8 @@ return 1     end
     for arg in $argv
         fd --hidden --print0 --max-depth 1 . $arg |
-            bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TR %TF %h/%f\0' \) |
-            sort --zero-terminated --key 1n,1 | head --zero-terminated --lines 1 |
-            cut --delimiter ' ' --fields 2,3
+            bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TR %TF %h/%f\n' \) |
+            sort --key 1n,1 | head --lines 1 |
+            cut -d ' ' -f 2,3
     end
 end