summaryrefslogtreecommitdiff
path: root/bin/hashl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-12-20 19:04:24 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-12-20 19:04:24 +0100
commit9920eb4fe2ec68b3c2f55acdb2355ecef23b914c (patch)
tree964e2619407648a5eb4cd8a0699707a6126e6924 /bin/hashl
parent0f78b32b38a3b90fbbb17f8c990477f42b1e1053 (diff)
Extend hashl info & document it
Diffstat (limited to 'bin/hashl')
-rwxr-xr-xbin/hashl22
1 files changed, 21 insertions, 1 deletions
diff --git a/bin/hashl b/bin/hashl
index f13ae7e..1f3af74 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -103,6 +103,17 @@ sub db_info {
);
}
+sub file_info {
+ my ($file) = @_;
+
+ printf(
+ "File: %s\nSize: %d bytes\nHash: %s\n",
+ $file,
+ $db->{'files'}->{$file}->{'size'},
+ $db->{'files'}->{$file}->{'hash'},
+ );
+}
+
sub process_file {
my $file = $File::Find::name;
my $path = $file;
@@ -183,7 +194,12 @@ elsif ($action ~~ [qw[know-file know-hash new-file new-hash]]) {
}
}
elsif ($action eq 'info') {
- db_info();
+ if ($ARGV[1]) {
+ file_info($ARGV[1]);
+ }
+ else {
+ db_info();
+ }
}
__END__
@@ -209,6 +225,10 @@ Checks if I<file> is in the database. Returns 0 if it is, 1 otherwise.
If I<file> is not specified, B<hashl> reads filenames from stdin and returns
those which are not already in the database.
+=item B<info> [I<file>]
+
+Show information I<file> (or the database, if I<file> is not specified).
+
=item B<update>
Update or create hash database. Iterates over all files below the current