- Timestamp:
- 05/19/12 09:35:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/bin/la-config
r985 r999 13 13 =head1 SYNOPSIS 14 14 15 List s upported base, synchronisation, objects and attributes15 List setup base, synchronisation 16 16 17 la-config [option] [object]17 la-config [option] 18 18 19 19 =cut … … 21 21 GetOptions( 22 22 'c|config=s' => \my $config, 23 'lb' => \my $listbases,24 23 'ls' => \my $listsynchros, 25 24 'base=s' => \my $base, … … 39 38 Perform query on this base 40 39 41 =item --lb42 43 List base setup in config44 45 40 =item --ls 46 41 … … 53 48 my $LA = LATMOS::Accounts->new($config, noacl => 1); 54 49 55 if ($listbases) {56 my $default = $LA->default_base_name || '';57 print "Bases:\n";58 foreach ($LA->list_bases) {59 printf(" %s %s (%s)\n",60 ($_ eq $default ? '*' : ' '),61 $_,62 $LA->val($_, 'type', 'Err: no type')63 );64 }65 }66 50 if ($listsynchros) { 67 51 my $default_sync = $LA->default_synchro_name || ''; … … 75 59 ); 76 60 } 77 } 78 if (!($listsynchros || $listbases)) { 79 if (my $otype = $ARGV[0]) { 80 my $labase = $base ? $LA->base($base) : $LA->default_base; 81 printf "Supported field for object type %s (base %s)\n", 82 $otype, 83 $base ? $base : $LA->default_base_name; 84 foreach($labase->list_canonical_fields($otype, 'a')) { 85 my $attr = $labase->attribute($otype, $_); 86 printf( 87 " %s (%s%s)\n", $_, 88 'r', 89 ($attr->readonly ? 'w' : ' '), 90 ) 91 } 92 } else { 93 my $labase = $base ? $LA->base($base) : $LA->default_base 94 or die "Cannot instanciate " . 95 $base ? $base : $LA->default_base_name . "\n"; 96 printf "Supported object type by base %s\n", 97 $base ? $base : $LA->default_base_name; 98 print " $_\n" foreach($labase->ordered_objects); 61 } else { 62 my $default = $LA->default_base_name || ''; 63 print "Bases:\n"; 64 foreach ($LA->list_bases) { 65 printf(" %s %s (%s)\n", 66 ($_ eq $default ? '*' : ' '), 67 $_, 68 $LA->val($_, 'type', 'Err: no type') 69 ); 99 70 } 100 71 }
Note: See TracChangeset
for help on using the changeset viewer.