From 9920eb4fe2ec68b3c2f55acdb2355ecef23b914c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 20 Dec 2010 19:04:24 +0100 Subject: Extend hashl info & document it --- bin/hashl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 is in the database. Returns 0 if it is, 1 otherwise. If I is not specified, B reads filenames from stdin and returns those which are not already in the database. +=item B [I] + +Show information I (or the database, if I is not specified). + =item B Update or create hash database. Iterates over all files below the current -- cgit v1.2.3