mirror of
https://github.com/speed47/btrfs-list
synced 2024-09-28 20:03:32 +00:00
feat: add --btrfs-binary
This commit is contained in:
parent
f4b7a2ea4a
commit
372ea532c4
12
btrfs-list
12
btrfs-list
|
@ -47,6 +47,8 @@ If no [mountpoint] is specified, display info for all btrfs filesystems.
|
||||||
--bright use bright colors (better for dark terminals)
|
--bright use bright colors (better for dark terminals)
|
||||||
-H, --no-header hide header from output
|
-H, --no-header hide header from output
|
||||||
-r, --raw show raw numbers instead of human-readable
|
-r, --raw show raw numbers instead of human-readable
|
||||||
|
--btrfs-binary BIN path to the btrfs binary to use instead of using the
|
||||||
|
first binary found in the PATH
|
||||||
|
|
||||||
-s, --hide-snap hide all snapshots
|
-s, --hide-snap hide all snapshots
|
||||||
-S, --snap-only only show snapshots
|
-S, --snap-only only show snapshots
|
||||||
|
@ -92,6 +94,7 @@ GetOptions(
|
||||||
'h|help|usage' => \my $opt_help,
|
'h|help|usage' => \my $opt_help,
|
||||||
'p|profile=s' => \my $opt_profile,
|
'p|profile=s' => \my $opt_profile,
|
||||||
'r|raw' => \my $opt_raw,
|
'r|raw' => \my $opt_raw,
|
||||||
|
'btrfs-binary=s' => \my $opt_btrfs_binary,
|
||||||
);
|
);
|
||||||
|
|
||||||
sub debug {
|
sub debug {
|
||||||
|
@ -106,6 +109,10 @@ sub run_cmd {
|
||||||
my $silent_stderr = $params{'silent_stderr'};
|
my $silent_stderr = $params{'silent_stderr'};
|
||||||
my $fatal = $params{'fatal'};
|
my $fatal = $params{'fatal'};
|
||||||
|
|
||||||
|
if ($cmd->[0] eq 'btrfs' && $opt_btrfs_binary) {
|
||||||
|
$cmd->[0] = $opt_btrfs_binary;
|
||||||
|
}
|
||||||
|
|
||||||
my ($_stdin, $_stdout, $_stderr);
|
my ($_stdin, $_stdout, $_stderr);
|
||||||
$_stderr = gensym;
|
$_stderr = gensym;
|
||||||
debug("about to run_cmd ['" . join("','", @$cmd) . "']");
|
debug("about to run_cmd ['" . join("','", @$cmd) . "']");
|
||||||
|
@ -241,6 +248,11 @@ if ($opt_show_all) {
|
||||||
$opt_show_uuid = 1;
|
$opt_show_uuid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_btrfs_binary && !-f -x $opt_btrfs_binary) {
|
||||||
|
print STDERR "FATAL: Specified btrfs binary '$opt_btrfs_binary' doesn't exist or is not executable\n";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
help() if $opt_help;
|
help() if $opt_help;
|
||||||
|
|
||||||
# check args
|
# check args
|
||||||
|
|
Loading…
Reference in a new issue