3 #=======================================================================
5 # File ID: a7e2ddb8-0584-11e5-9395-000df06acc56
7 # Scan stdin or files specified on the command line for SHA256 keys
8 # created by git-annex.
10 # Character set: UTF-8
11 # ©opyleft 2015– Øyvind A. Holm <sunny@sunbase.org>
12 # License: GNU General Public License version 2 or later, see end of
13 # file for legal stuff.
14 #=======================================================================
33 $progname =~ s/^.*\/(.*?)$/$1/;
34 our $VERSION = '0.1.0';
36 Getopt
::Long
::Configure
('bundling');
39 'help|h' => \
$Opt{'help'},
40 'quiet|q+' => \
$Opt{'quiet'},
41 'unique|u' => \
$Opt{'unique'},
42 'verbose|v+' => \
$Opt{'verbose'},
43 'version' => \
$Opt{'version'},
45 ) || die("$progname: Option error. Use -h for help.\n");
47 $Opt{'verbose'} -= $Opt{'quiet'};
48 $Opt{'help'} && usage
(0);
49 if ($Opt{'version'}) {
63 s/(SHA256-s\d+--[0-9a-f]{64})/print_key($1)/ge;
74 $keys{"$key"} || print("$key\n");
84 # Print program version {{{
85 print("$progname $VERSION\n");
91 # Send the help message to stdout {{{
94 if ($Opt{'verbose'}) {
100 Usage: $progname [options] [file [files [...]]]
102 Scan stdin or files specified on the command line for SHA256 keys
103 created by git-annex.
110 Be more quiet. Can be repeated to increase silence.
112 Remove duplicate keys from output, print every key only once.
114 Increase level of verbosity. Can be repeated.
116 Print version information.
124 # Print a status message to stderr based on verbosity level {{{
125 my ($verbose_level, $Txt) = @_;
127 if ($Opt{'verbose'} >= $verbose_level) {
128 print(STDERR
"$progname: $Txt\n");
136 # This program is free software; you can redistribute it and/or modify
137 # it under the terms of the GNU General Public License as published by
138 # the Free Software Foundation; either version 2 of the License, or (at
139 # your option) any later version.
141 # This program is distributed in the hope that it will be useful, but
142 # WITHOUT ANY WARRANTY; without even the implied warranty of
143 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
144 # See the GNU General Public License for more details.
146 # You should have received a copy of the GNU General Public License
147 # along with this program.
148 # If not, see L<http://www.gnu.org/licenses/>.
150 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :