CWB
view release on metacpan or search on metacpan
script/cwb-regedit view on Meta::CPAN
#!/usr/bin/perl
## -*-cperl-*-
## Author: Stephanie Evert
## Purpose: simple command-line registry file editor
##
$| = 1;
use warnings;
use strict;
use locale;
use CWB;
use Getopt::Long;
sub Usage {
die <<STOP;
Usage: cwb-regedit [options] (CORPUS | <filename>) <command> [<command> ...]
Options:
-r <dir> use registry directory <dir> [system default]
--registry=<dir>
-h show this help page
--help
Commands:
:info print basic information about the registry entry
:reg print pathname of registry file
(:id | :home | :name | :ifile) [<value>]
print or set corpus ID (:id), data directory (:home),
descriptive name (:name) or info file path (:ifile)
:prop <property> [<value>]
query or set corpus property
:list (:p | :s | :a)
list declared attributes of specified type
:add (:p | :s | :a) <name>[=<path>] ...
add positional, structural or alignment attributes
:del <names>
delete attributes of any type
Command names are case-insensitive, and some intuitive abbreviations and variations
are allowed (but only the forms listed above are guaranteed to work).
STOP
}
our $Registry = undef; # -r, --registry
our $Help = 0; # -h, --help
{
my $ok = GetOptions(
"r|registry=s" => \$Registry,
"h|help" => \$Help,
);
Usage()
if $Help or @ARGV < 2 or not $ok;
}
our $Corpus = shift @ARGV;
if (defined $Registry) {
$ENV{CORPUS_REGISTRY} = $Registry; # the CWB module uses this environment var to locate registry files
}
our $reg = new CWB::RegistryFile $Corpus;
die "Registry file not found. Aborted.\n"
unless defined $reg;
our $COMMAND = "";
our @ARGS = ();
( run in 2.191 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )