diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-18 00:43:37 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-18 00:43:37 -0600 |
| commit | 149f236701dda8c8ff5e9ee68df39ee21b57f139 (patch) | |
| tree | 37cb97302786221ff0f4e6dddaeb7da54bad05a0 /dotfiles | |
| parent | ef9d6b33df9948a3a4847696cc0c5aaeca8f8596 (diff) | |
fix(zfsrollback): sort snapshots with newest first
Diffstat (limited to 'dotfiles')
| -rwxr-xr-x | dotfiles/system/.local/bin/zfsrollback | 7 |
1 files changed, 4 insertions, 3 deletions
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)" \ |
