-my %opt;
-
-if ( !getopts("cdm:v:ijfqh:", \%opt ) ) {
- print STDERR <<EOF;
-usage: $0 [-c|-d] [-m num] [-v|-v level] [-i|-j|-f]
-
-Options:
- -c create database on first use
- -d delete database before import
- -m num import just num increments for one host
- -h "h1 h2" import just single HostList hosts
- -v num set verbosity (debug) level (default $debug)
- -i update Hyper Estraier full text index
- -j update full text, don't check existing files
- -f don't do anything with full text index
- -q be quiet for hosts without changes
-
-Option -j is variation on -i. It will allow faster initial creation
-of full-text index from existing database.
-
-Option -f will create database which is out of sync with full text index. You
-will have to re-run $0 with -i to fix it.
-
-EOF
- exit 1;
-}
-
-if ($opt{v}) {
- print "Debug level at $opt{v}\n";
- $debug = $opt{v};
-} elsif ($opt{f}) {
- print "WARNING: disabling full-text index update. You need to re-run $0 -j !\n";
- $index_node_url = undef;
-}
+my ($opt,$usage) = describe_options(
+"%c %o",
+[ 'create|c', "create database on first use" ],
+[ 'delete|d', "delete database before import" ],
+[ 'max|m=i', "import just max increments for one host" ],
+[ 'host|h=s@', "import just host(s)" ],
+[],
+[ 'verbose|v:i', 'set verbosity (debug) level' ],
+[ 'index|i', 'update full text index' ],
+[ 'junk|j', "update full text, don't check existing files" ],
+[ 'fast|f', "don't do anything with full text index" ],
+[ 'quiet|q', "be quiet for hosts without changes" ],
+[ 'help', "show help" ],
+);
+
+print($usage->text), exit if $opt->help;
+
+warn "hosts: ",dump( $opt->host );