From d80a8abb8a2bdb7b766c71730b6a06e7049403df Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Fri, 16 Apr 2021 22:08:39 +0200 Subject: [PATCH] btrbk: add "latest" output format Same as "resolved", but hides target if none present. --- btrbk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/btrbk b/btrbk index fbf36c3..cf1d33c 100755 --- a/btrbk +++ b/btrbk @@ -226,6 +226,13 @@ my %table_formats = ( raw => [ qw( source_url source_host source_port source_path snapshot_subvolume snapshot_name status source_rsh ) ], }, + latest => { # same as resolved, except hiding target if not present + # NOTE: snapshot_path is ambigous and does NOT print SUBVOL_PATH here (should be snapshot_subvolume, left as-is for compatibility) + table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port -target_subvolume ) ], + long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port -target_subvolume -target_type ) ], + raw => [ qw( type source_url source_host source_port source_path snapshot_path snapshot_name status target_url target_host target_port target_path target_type source_rsh target_rsh ) ], + }, + stats => { table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshots -backups ) ], long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshot_status backup_status snapshots -backups -correlated -orphaned -incomplete ) ], @@ -6849,6 +6856,9 @@ MAIN: elsif($action_resolve eq "snapshots") { print_formatted("snapshots", \@data); } + elsif($action_resolve eq "latest") { + print_formatted("latest", \@data); + } else { print_formatted("resolved", \@data); }