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 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use LATMOS::Accounts; |
---|
6 | use Getopt::Long; |
---|
7 | use Pod::Usage; |
---|
8 | use 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 | |
---|
21 | For the default object_type (user), obj_id = login. |
---|
22 | |
---|
23 | Example : la-query lambda |
---|
24 | |
---|
25 | =cut |
---|
26 | |
---|
27 | GetOptions( |
---|
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 | |
---|
41 | Use this configuration file instead of the default one. |
---|
42 | |
---|
43 | =item -b|--base basename |
---|
44 | |
---|
45 | Query this specific base instead of the default one. |
---|
46 | |
---|
47 | =item --noexp |
---|
48 | |
---|
49 | Take into account all objects (even non propagated ones, with attribute 'exported'=0) |
---|
50 | |
---|
51 | =item --exp |
---|
52 | |
---|
53 | Take into account only propagated objects (attribute 'exported'=1) (default) |
---|
54 | |
---|
55 | =back |
---|
56 | |
---|
57 | =cut |
---|
58 | |
---|
59 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
60 | my $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 | |
---|
65 | my $globalenv = LATMOS::Accounts::Cli::globalenv($labase); |
---|
66 | |
---|
67 | if (@ARGV) { |
---|
68 | $globalenv->run(@ARGV); |
---|
69 | } else { |
---|
70 | $globalenv->cli; |
---|
71 | } |
---|
72 | print "\n"; |
---|
73 | |
---|
74 | exit 0; |
---|
75 | |
---|
Note: See
TracBrowser
for help on using the repository browser.