Add `rdbl-luks`, git textconv diff filter for LUKS headers
[sunny256-utils.git] / wn
blob21decd640bd2c560a0d1290b3320d82c109a10cc
1 #!/usr/bin/env perl
3 #=======================================================================
4 # wn
5 # File ID: 58bc21ea-f744-11dd-afa7-000475e441b9
6 # “What’s New” — Lists changes in a Subversion working copy which
7 # haven’t been downloaded yet. Or in other words, see what has happened
8 # in the directory tree since your last update.
10 # Character set: UTF-8
11 # ©opyleft 2008– Ø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 #=======================================================================
16 use strict;
17 use warnings;
18 use Getopt::Long;
20 $| = 1;
22 our $Debug = 0;
24 our %Opt = (
26 'debug' => 0,
27 'help' => 0,
28 'verbose' => 0,
29 'version' => 0,
33 our $progname = $0;
34 $progname =~ s/^.*\/(.*?)$/$1/;
35 our $VERSION = "0.00";
37 Getopt::Long::Configure("bundling");
38 GetOptions(
40 "debug" => \$Opt{'debug'},
41 "help|h" => \$Opt{'help'},
42 "verbose|v+" => \$Opt{'verbose'},
43 "version" => \$Opt{'version'},
45 ) || die("$progname: Option error. Use -h for help.\n");
47 $Opt{'debug'} && ($Debug = 1);
48 $Opt{'help'} && usage(0);
49 if ($Opt{'version'}) {
50 print_version();
51 exit(0);
54 my $curr = `svn info --xml .`;
55 $curr =~ s/^.*?<entry\b.+revision="(\d+)".*$/$1/s;
56 system(sprintf("svn log -r%lu:HEAD %s%s | less",
57 $curr+1,
58 $Opt{'verbose'} ? "-v " : "",
59 join(" ", @ARGV)
60 ));
62 sub print_version {
63 # Print program version {{{
64 print("$progname v$VERSION\n");
65 # }}}
66 } # print_version()
68 sub usage {
69 # Send the help message to stdout {{{
70 my $Retval = shift;
72 if ($Opt{'verbose'}) {
73 print("\n");
74 print_version();
76 print(<<END);
78 Usage: $progname [options] [file [files [...]]]
80 Options:
82 -h, --help
83 Show this help.
84 -v, --verbose
85 Increase level of verbosity. Can be repeated.
86 --version
87 Print version information.
88 --debug
89 Print debugging messages.
91 END
92 exit($Retval);
93 # }}}
94 } # usage()
96 sub msg {
97 # Print a status message to stderr based on verbosity level {{{
98 my ($verbose_level, $Txt) = @_;
100 if ($Opt{'verbose'} >= $verbose_level) {
101 print(STDERR "$progname: $Txt\n");
103 # }}}
104 } # msg()
106 sub D {
107 # Print a debugging message {{{
108 $Debug || return;
109 my @call_info = caller;
110 chomp(my $Txt = shift);
111 my $File = $call_info[1];
112 $File =~ s#\\#/#g;
113 $File =~ s#^.*/(.*?)$#$1#;
114 print(STDERR "$File:$call_info[2] $$ $Txt\n");
115 return("");
116 # }}}
117 } # D()
119 __END__
121 # Plain Old Documentation (POD) {{{
123 =pod
125 =head1 NAME
129 =head1 SYNOPSIS
131 [options] [file [files [...]]]
133 =head1 DESCRIPTION
137 =head1 OPTIONS
139 =over 4
141 =item B<-h>, B<--help>
143 Print a brief help summary.
145 =item B<-v>, B<--verbose>
147 Increase level of verbosity. Can be repeated.
149 =item B<--version>
151 Print version information.
153 =item B<--debug>
155 Print debugging messages.
157 =back
159 =head1 BUGS
163 =head1 AUTHOR
165 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
167 =head1 COPYRIGHT
169 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
170 This is free software; see the file F<COPYING> for legalese stuff.
172 =head1 LICENCE
174 This program is free software: you can redistribute it and/or modify it
175 under the terms of the GNU General Public License as published by the
176 Free Software Foundation, either version 2 of the License, or (at your
177 option) any later version.
179 This program is distributed in the hope that it will be useful, but
180 WITHOUT ANY WARRANTY; without even the implied warranty of
181 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
182 See the GNU General Public License for more details.
184 You should have received a copy of the GNU General Public License along
185 with this program.
186 If not, see L<http://www.gnu.org/licenses/>.
188 =head1 SEE ALSO
190 =cut
192 # }}}
194 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :