summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-06-13 09:25:27 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-06-13 09:25:27 +0200
commit8a97f5cec2a22a5074154837ed4519ce70fcac69 (patch)
tree44fe8c9316bc0ee42640b665474150a8001e67b8
parent4c6a103f82fa7f3ad32ce66e3452c6e7b6f94c4b (diff)
Add "hashl list <regex>" to filter listed files by name
-rw-r--r--Changelog6
-rwxr-xr-xbin/hashl12
2 files changed, 16 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index a38c56d..5e5d34a 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,8 @@
-App::Hashl 0.2 - Mon May 23 2011
+git HEAD
+
+ * Add "hashl list <regex>" to filter listed files by name
+
+hashl 0.2 - Mon May 23 2011
* The internal representation of ignored hashes was changed
* hashl update no longer re-adds ignored (but existing) files
diff --git a/bin/hashl b/bin/hashl
index f1e6cf8..85825bc 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -341,6 +341,8 @@ sub cmd_info {
}
sub cmd_list {
+ my ($re) = @_;
+
printf(
"# hashl v%s Read Size %d bytes (%s)\n",
$VERSION, $hashl->read_size(), $hashl->si_size( $hashl->read_size() ),
@@ -348,6 +350,11 @@ sub cmd_list {
for my $name ( sort $hashl->files() ) {
my $file = $hashl->file($name);
+
+ if ( $re and $name !~ m{$re} ) {
+ next;
+ }
+
printf( "%s %-7s %s\n",
$file->{hash}, $hashl->si_size( $file->{size} ), $name );
}
@@ -443,10 +450,13 @@ files for B<copy> or B<find-new>.
Show information on I<file> (or the database, if I<file> is not specified).
-=item B<list>
+=item B<list> [I<regex>]
List all files and their hashes. The list format is C<< hash size file >>.
+If I<regex> (a perl regular expression) is specifed, only matching files will
+be listed.
+
=item B<list-files>
List all filenames, one file per line.