(plugin) apps::protocols::cifs - add --filter-file option (#4165)
This commit is contained in:
parent
70baae18f4
commit
c00a652421
|
@ -118,6 +118,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-file:s' => { name => 'filter_file' }
|
||||
'directory:s@' => { name => 'directory' },
|
||||
'file:s@' => { name => 'file' },
|
||||
'max-depth:s' => { name => 'max_depth', default => 0 },
|
||||
|
@ -190,6 +191,9 @@ sub check_directory {
|
|||
|
||||
my $name = $dir . '/' . $file->[1];
|
||||
|
||||
next if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_file}/);
|
||||
|
||||
if ($file->[0] == SMBC_DIR) {
|
||||
if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) {
|
||||
push @$list, { name => $name, level => $level + 1 };
|
||||
|
@ -263,7 +267,7 @@ Check files.
|
|||
|
||||
=item B<--directory>
|
||||
|
||||
Check directory (Multiple option)
|
||||
Check directory (Multiple option).
|
||||
|
||||
=item B<--max-depth>
|
||||
|
||||
|
@ -271,7 +275,11 @@ Don't check fewer levels (Default: '0'. Means current dir only). Used for direct
|
|||
|
||||
=item B<--file>
|
||||
|
||||
Check file (Multiple option)
|
||||
Check file (Multiple option).
|
||||
|
||||
=item B<--filter-file>
|
||||
|
||||
Filter files (can be a regexp. Directory in the name).
|
||||
|
||||
=item B<--timezone>
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ Count files in a directory (can be recursive).
|
|||
|
||||
=item B<--directory>
|
||||
|
||||
Check files in the directory (Multiple option)
|
||||
Check files in the directory (Multiple option).
|
||||
|
||||
=item B<--max-depth>
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-file:s' => { name => 'filter_file' },
|
||||
'directory:s@' => { name => 'directory' },
|
||||
'file:s@' => { name => 'file' },
|
||||
'timezone:s' => { name => 'timezone' },
|
||||
|
@ -155,6 +156,9 @@ sub manage_selection {
|
|||
|
||||
my $name = $dir . '/' . $file->[1];
|
||||
|
||||
next if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_file}/);
|
||||
|
||||
$rv = $options{custom}->stat_file(file => $name);
|
||||
if ($rv->{code} != 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "cannot stat file '" . $name . "': " . $rv->{message});
|
||||
|
@ -206,6 +210,10 @@ Check files in the directory (no recursive) (Multiple option)
|
|||
|
||||
Check file (Multiple option)
|
||||
|
||||
=item B<--filter-file>
|
||||
|
||||
Filter files (can be a regexp. Directory in the name).
|
||||
|
||||
=item B<--timezone>
|
||||
|
||||
Set the timezone of display date.
|
||||
|
|
|
@ -58,6 +58,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-file:s' => { name => 'filter_file' },
|
||||
'directory:s@' => { name => 'directory' },
|
||||
'file:s@' => { name => 'file' },
|
||||
'max-depth:s' => { name => 'max_depth', default => 0 }
|
||||
|
@ -120,6 +121,9 @@ sub check_directory {
|
|||
|
||||
my $name = $dir . '/' . $file->[1];
|
||||
|
||||
next if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_file}/);
|
||||
|
||||
if ($file->[0] == SMBC_DIR) {
|
||||
if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) {
|
||||
push @$list, { name => $name, level => $level + 1 };
|
||||
|
@ -175,6 +179,10 @@ Can get sub directory size with --max-depth option.
|
|||
|
||||
Check file (Multiple option)
|
||||
|
||||
=item B<--filter-file>
|
||||
|
||||
Filter files (can be a regexp. Directory in the name).
|
||||
|
||||
=item B<--max-depth>
|
||||
|
||||
Don't check fewer levels (Default: '0'. Means current dir only).
|
||||
|
|
Loading…
Reference in New Issue