Changeset 455 for LATMOS-Accounts/bin/la-config
- Timestamp:
- 09/10/09 22:29:54 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/bin/la-config
r128 r455 13 13 =head1 SYNOPSIS 14 14 15 Show configured bases: 15 List supported base, synchronisation, objects and attributes 16 16 17 la-config 18 19 List supported attribute: 20 21 la-config [option] att 22 la-config [option] att objects_type 17 la-config [option] [object] 23 18 24 19 =cut … … 26 21 GetOptions( 27 22 'c|config=s' => \my $config, 28 'b|base=s' => \my $base, 23 'lb' => \my $listbases, 24 'ls' => \my $listsynchros, 25 'base=s' => \my $base, 29 26 'help' => sub { pod2usage(0) }, 30 27 ) or pod2usage(); … … 40 37 Perform query on this base 41 38 39 40 =item --lb 41 42 List base setup in config 43 44 =item --ls 45 46 List synchronisation setup in config 47 42 48 =cut 43 49 44 50 my $LA = LATMOS::Accounts->new($config); 45 51 46 my $action = shift(@ARGV) || ''; 47 for ($action) { 48 m/^$/ and do {49 my $default = $LA->default_base_name || '';50 print "Bases:\n";51 foreach ($LA->list_bases) {52 printf(" %s %s (%s)\n",53 ($_ eq $default ? '*' : ' '),54 $_,55 $LA->val($_, 'type', 'Err: no type')56 ); 57 } 58 59 60 61 62 63 64 65 66 67 68 last; 69 }; 70 m/^att(ributes)?$/ and do{52 if ($listbases) { 53 my $default = $LA->default_base_name || ''; 54 print "Bases:\n"; 55 foreach ($LA->list_bases) { 56 printf(" %s %s (%s)\n", 57 ($_ eq $default ? '*' : ' '), 58 $_, 59 $LA->val($_, 'type', 'Err: no type') 60 ); 61 } 62 } 63 if ($listsynchros) { 64 my $default_sync = $LA->default_synchro_name || ''; 65 print "Syncro:\n"; 66 foreach ($LA->list_synchro) { 67 printf(" %s %s (%s => %s)\n", 68 ($_ eq $default_sync ? '*' : ' '), 69 $_, 70 $LA->val("sync:$_", 'from', 'Err: No from'), 71 join(', ', $LA->val("sync:$_", 'to', 'Err: No to')), 72 ); 73 } 74 } 75 if (!($listsynchros || $listbases)) { 76 if (my $otype = $ARGV[0]) { 71 77 my $labase = $base ? $LA->base($base) : $LA->default_base; 72 if (my $otype = shift(@ARGV)) { 73 printf "Supported field for object type %s (base %s)\n", 74 $otype, 75 $base ? $base : $LA->default_base_name; 76 printf( 77 " %s (%s%s)\n", $_, 78 ($labase->get_field_name($otype, $_, 'r') ? 'r' : ' '), 79 ($labase->get_field_name($otype, $_, 'w') ? 'w' : ' '), 80 ) foreach($labase->list_canonical_fields($otype, 'a')); 81 } else { 82 printf "Supported object type by base %s\n", 83 $base ? $base : $LA->default_base_name; 84 print " $_\n" foreach($labase->list_supported_objects); 85 } 86 }; 78 printf "Supported field for object type %s (base %s)\n", 79 $otype, 80 $base ? $base : $LA->default_base_name; 81 printf( 82 " %s (%s%s)\n", $_, 83 ($labase->get_field_name($otype, $_, 'r') ? 'r' : ' '), 84 ($labase->get_field_name($otype, $_, 'w') ? 'w' : ' '), 85 ) foreach($labase->list_canonical_fields($otype, 'a')); 86 } else { 87 my $labase = $base ? $LA->base($base) : $LA->default_base; 88 printf "Supported object type by base %s\n", 89 $base ? $base : $LA->default_base_name; 90 print " $_\n" foreach($labase->list_supported_objects); 91 } 87 92 }
Note: See TracChangeset
for help on using the changeset viewer.