source: trunk/LATMOS-Accounts/bin/la-config @ 1634

Last change on this file since 1634 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
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8
9=head1 NAME
10
11    la-config - Tools to query configuration of LATMOS::Accounts system.
12
13=head1 SYNOPSIS
14
15List setup base, synchronisation
16
17    la-config [option]
18
19=cut
20
21GetOptions(
22    'c|config=s' => \my $config,
23    'ls'         => \my $listsynchros,
24    'base=s'     => \my $base,
25    'help'       => sub { pod2usage(0) },
26) or pod2usage();
27
28=head1 OPTIONS
29
30=over 4
31
32=item -c|--config configdir
33
34Use this configuration directory instead of the default one.
35
36=item -b|--base basename
37
38Perform query on this base
39
40=item --ls
41
42List synchronisation setup in config
43
44=back
45
46=cut
47
48my $LA = LATMOS::Accounts->new($config, noacl => 1);
49
50if ($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    }
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        );
70    }
71}
Note: See TracBrowser for help on using the repository browser.