my %CONFIG;
sub usage(;$) {
my $rv = shift // 0;
- print STDERR "TODO $NAME usage\n";
+ print STDERR "$NAME [OPTIONS] [--] [MAILBOX [..]]\n";
+ if ($rv) {
+ print STDERR "Try '$NAME --help' or consult the manpage for more information.\n";
+ }
+ else {
+ print STDERR "Synchronize the given MAILBOXes between two QRESYNC-capable IMAP4rev1 servers.\n"
+ ."Options:\n"
+ ." --config=FILE Specify an alternate configuration file\n"
+ ." -1, --oneshot Exit as soon as all mailboxes are synchronized\n"
+ ." --repair List the database anomalies and try to repair them\n"
+ ." -q, --quiet Try to be quiet\n"
+ ." --debug Turn on debug mode\n"
+ ."Consult the manpage for more information.\n";
+ }
exit $rv;
}
-usage(1) unless GetOptions(\%CONFIG, qw/debug help|h config=s quiet|q oneshot|1 repair/);
+usage(1) unless GetOptions(\%CONFIG, qw/config=s quiet|q oneshot|1 repair debug help|h/);
usage(0) if $CONFIG{help};