source: LATMOS-Accounts/bin/la-cli @ 844

Last change on this file since 844 was 844, checked in by nanardon, 14 years ago
  • split la-cli into specific package
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8use LATMOS::Accounts::Cli;
9
10=head1 NAME
11
12    la-query - Tools to query base in LATMOS::Accounts system
13
14=head1 SYNOPSIS
15
16    la-query [options] [obj_id]
17
18=item [obj_id] : If present, all set attributes (rw) will be displayed for that obj_id.
19        If none is given, all obj_ids will be printed.
20
21For the default object_type (user), obj_id = login.
22
23Example : la-query lambda
24
25=cut
26
27GetOptions(
28    'c|config=s' => \my $config,
29    'b|base=s'   => \my $base,
30    'noexp'      => \my $noexp,
31    'exp'        => \my $exp,
32    'help'       => sub { pod2usage(0) },
33) or pod2usage();
34
35=head1 OPTIONS
36
37=over 4
38
39=item -c|--config configfile
40
41Use this configuration file instead of the default one.
42
43=item -b|--base basename
44
45Query this specific base instead of the default one.
46
47=item --noexp
48
49Take into account all objects (even non propagated ones, with attribute 'exported'=0)
50
51=item --exp
52
53Take into account only propagated objects (attribute 'exported'=1) (default)
54
55=back
56
57=cut
58
59my $LA = LATMOS::Accounts->new($config, noacl => 1);
60my $labase = $base ? $LA->base($base) : $LA->default_base;
61$labase && $labase->load or die "Cannot load base";
62
63$labase->wexported($noexp ? 0 : 1);
64
65my $globalenv = LATMOS::Accounts::Cli::globalenv($labase);
66
67if (@ARGV) {
68    $globalenv->run(@ARGV);
69} else {
70    $globalenv->cli;
71}
72print "\n";
73
74exit 0;
75
Note: See TracBrowser for help on using the repository browser.