From 149f236701dda8c8ff5e9ee68df39ee21b57f139 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 18 Jan 2026 00:43:37 -0600 Subject: fix(zfsrollback): sort snapshots with newest first --- dotfiles/system/.local/bin/zfsrollback | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dotfiles/system/.local/bin/zfsrollback') diff --git a/dotfiles/system/.local/bin/zfsrollback b/dotfiles/system/.local/bin/zfsrollback index f1365e6..a03cd57 100755 --- a/dotfiles/system/.local/bin/zfsrollback +++ b/dotfiles/system/.local/bin/zfsrollback @@ -66,8 +66,8 @@ if [ -z "$snapshots" ]; then fi if $single_mode; then - # Single mode: show full dataset@snapshot names - selected=$(echo "$snapshots" | fzf --height=40% --reverse \ + # Single mode: show full dataset@snapshot names (sorted newest first) + selected=$(zfs list -t snapshot -H -o name -S creation | fzf --height=40% --reverse \ --header="Select snapshot to roll back (ESC to cancel)" \ --preview="zfs list -t snapshot -o name,creation,used,refer -r {1}" \ --preview-window=down:3) @@ -82,7 +82,8 @@ if $single_mode; then targets=("$selected") else # Multi mode: show unique snapshot names, roll back all matching datasets - unique_snaps=$(echo "$snapshots" | sed 's/.*@//' | sort -u) + # Sort reverse so newest (latest date) appears at top + unique_snaps=$(echo "$snapshots" | sed 's/.*@//' | sort -ru) snap_name=$(echo "$unique_snaps" | fzf --height=40% --reverse \ --header="Select snapshot name to roll back ALL matching datasets (ESC to cancel)" \ -- cgit v1.2.3