Last change
on this file since 1382 was
999,
checked in by nanardon, 12 years ago
|
- simplify la-config, then aovid redundancy with la-attributes
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id Rev
|
File size:
1.3 KB
|
Rev | Line | |
---|
[25] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use LATMOS::Accounts; |
---|
| 6 | use Getopt::Long; |
---|
| 7 | use Pod::Usage; |
---|
| 8 | |
---|
[38] | 9 | =head1 NAME |
---|
| 10 | |
---|
| 11 | la-config - Tools to query configuration of LATMOS::Accounts system. |
---|
| 12 | |
---|
| 13 | =head1 SYNOPSIS |
---|
| 14 | |
---|
[999] | 15 | List setup base, synchronisation |
---|
[38] | 16 | |
---|
[999] | 17 | la-config [option] |
---|
[38] | 18 | |
---|
| 19 | =cut |
---|
| 20 | |
---|
[25] | 21 | GetOptions( |
---|
| 22 | 'c|config=s' => \my $config, |
---|
[455] | 23 | 'ls' => \my $listsynchros, |
---|
| 24 | 'base=s' => \my $base, |
---|
[38] | 25 | 'help' => sub { pod2usage(0) }, |
---|
[25] | 26 | ) or pod2usage(); |
---|
| 27 | |
---|
[38] | 28 | =head1 OPTIONS |
---|
| 29 | |
---|
[985] | 30 | =over 4 |
---|
| 31 | |
---|
[861] | 32 | =item -c|--config configdir |
---|
[38] | 33 | |
---|
[861] | 34 | Use this configuration directory instead of the default one. |
---|
[38] | 35 | |
---|
| 36 | =item -b|--base basename |
---|
| 37 | |
---|
| 38 | Perform query on this base |
---|
| 39 | |
---|
[455] | 40 | =item --ls |
---|
| 41 | |
---|
| 42 | List synchronisation setup in config |
---|
| 43 | |
---|
[985] | 44 | =back |
---|
| 45 | |
---|
[38] | 46 | =cut |
---|
| 47 | |
---|
[457] | 48 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
[25] | 49 | |
---|
[455] | 50 | if ($listsynchros) { |
---|
| 51 | my $default_sync = $LA->default_synchro_name || ''; |
---|
| 52 | print "Syncro:\n"; |
---|
| 53 | foreach ($LA->list_synchro) { |
---|
| 54 | printf(" %s %s (%s => %s)\n", |
---|
| 55 | ($_ eq $default_sync ? '*' : ' '), |
---|
| 56 | $_, |
---|
| 57 | $LA->val("sync:$_", 'from', 'Err: No from'), |
---|
| 58 | join(', ', $LA->val("sync:$_", 'to', 'Err: No to')), |
---|
| 59 | ); |
---|
| 60 | } |
---|
[999] | 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 | ); |
---|
[455] | 70 | } |
---|
[25] | 71 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.