Last change
on this file since 2203 was
2203,
checked in by nanardon, 5 years ago
|
Add a begin command
|
-
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-cli - A powerfull commandline tool to manage LATMOS::Accounts contents |
---|
13 | |
---|
14 | =head1 SYNOPSIS |
---|
15 | |
---|
16 | la-cli [options] |
---|
17 | |
---|
18 | =cut |
---|
19 | |
---|
20 | GetOptions( |
---|
21 | 'c|config=s' => \my $config, |
---|
22 | 'b|base=s' => \my $base, |
---|
23 | 't|transaction' => sub { $LATMOS::Accounts::Cli::trans_mode = 1 }, |
---|
24 | 'no-unexp|wo-unexp' => \my $nounexp, |
---|
25 | 'with-unexp' => \my $unexp, |
---|
26 | 'help' => sub { pod2usage(0) }, |
---|
27 | ) or pod2usage(); |
---|
28 | |
---|
29 | =head1 OPTIONS |
---|
30 | |
---|
31 | =over 4 |
---|
32 | |
---|
33 | =item -c|--config configdir |
---|
34 | |
---|
35 | Use this configuration directory instead of the default one. |
---|
36 | |
---|
37 | =item -b|--base basename |
---|
38 | |
---|
39 | Query this specific base instead of the default one. |
---|
40 | |
---|
41 | =item -t|--transaction |
---|
42 | |
---|
43 | Enable transaction mode: don't commit at earch command |
---|
44 | |
---|
45 | =item --unexp |
---|
46 | |
---|
47 | Take into account all objects (even non propagated ones, with attribute 'exported'=0) |
---|
48 | |
---|
49 | =item --no-unexp |
---|
50 | |
---|
51 | Take into account only propagated objects (attribute 'exported'=1) (default) |
---|
52 | |
---|
53 | =back |
---|
54 | |
---|
55 | =cut |
---|
56 | |
---|
57 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
58 | my $labase = $LA->base($base); |
---|
59 | $labase && $labase->load or die "Cannot load base"; |
---|
60 | |
---|
61 | $labase->unexported($nounexp ? 0 : 1); |
---|
62 | |
---|
63 | my $globalenv = LATMOS::Accounts::Cli::globalenv($labase); |
---|
64 | |
---|
65 | if (@ARGV) { |
---|
66 | $globalenv->run(@ARGV); |
---|
67 | } else { |
---|
68 | $globalenv->cli; |
---|
69 | } |
---|
70 | print "\n"; |
---|
71 | |
---|
72 | exit 0; |
---|
73 | |
---|
Note: See
TracBrowser
for help on using the repository browser.