From 792c3de6c0bc6141ebc91a5396b790836530f871 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 20 Dec 2020 18:32:41 +0100 Subject: [PATCH] btrbk: separate format for "ist snapshots" Make sure target_subvolume is always printed for "resolved" format. --- btrbk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/btrbk b/btrbk index 9c1ab9b..0e26904 100755 --- a/btrbk +++ b/btrbk @@ -203,12 +203,17 @@ my %table_formats = ( raw => [ qw( source_url source_host source_port source_subvolume snapshot_path snapshot_name target_url target_host target_port target_path target_type snapshot_preserve target_preserve source_rsh target_rsh ) ], }, - resolved => { 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 ) ], + resolved => { 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 ) ], # NOTE: snapshot_path is ambigous and does NOT print SUBVOL_PATH here (should be snapshot_subvolume, left as-is for compatibility) }, + snapshots => { table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ], + long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ], + raw => [ qw( source_url source_host source_port source_path snapshot_subvolume snapshot_name status source_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 ) ], raw => [ qw( source_url source_host source_port source_subvolume snapshot_subvolume snapshot_name target_url target_host target_port target_subvolume snapshot_status backup_status snapshots backups correlated orphaned incomplete ) ], @@ -405,7 +410,7 @@ commands: archive recursively copy all subvolumes clean delete incomplete (garbled) backups stats print snapshot/backup statistics - list available subcommands are: + list available subcommands are (default "all"): all snapshots and backups snapshots snapshots backups backups and correlated snapshots @@ -6825,7 +6830,10 @@ MAIN: [ { a => $stats{snapshots}, b => "snapshots", c => " " }, { a => $stats{backups}, b => "backups", c => $bflags } ], output_format => "table", no_header => 1); - } + } + elsif($action_resolve eq "snapshots") { + print_formatted("snapshots", \@data); + } else { print_formatted("resolved", \@data); }