7 use Gruta
::Source
::DBI
;
17 $cmd = shift(@ARGV) or usage
();
18 $src_str = shift(@ARGV) or usage
();
20 $src = new_source
($src_str);
21 $g = Gruta
->new( sources
=> $src );
24 my $new_src = shift(@ARGV) or usage
();
25 my $dst = new_source
( $new_src );
29 $g->transfer_to_source( $dst );
31 elsif ($cmd eq 'topics') {
32 foreach my $t ($g->topics()) {
36 elsif ($cmd eq 'topic') {
37 my $topic_id = shift(@ARGV) or usage
();
39 my $topic = $g->topic($topic_id);
41 foreach my $f ($topic->afields()) {
42 print $f, ': ', ($topic->get($f) || 'UNDEF'), "\n";
45 elsif ($cmd eq 'edit_story') {
46 my $topic = shift(@ARGV) or usage
();
47 my $id = shift(@ARGV) or usage
();
49 my $story = $g->story($topic, $id);
60 print "Usage: $0 {cmd} {source}\n";
69 if ($src_str =~ /^dbi:/) {
70 $src = Gruta
::Source
::DBI
->new( string
=> $src_str );
73 $src = Gruta
::Source
::FS
->new( path
=> $src_str );