source: trunk/LATMOS-Accounts/bin/la-cli @ 2203

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
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8use 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
20GetOptions(
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
35Use this configuration directory instead of the default one.
36
37=item -b|--base basename
38
39Query this specific base instead of the default one.
40
41=item -t|--transaction
42
43Enable transaction mode: don't commit at earch command
44
45=item --unexp
46
47Take into account all objects (even non propagated ones, with attribute 'exported'=0)
48
49=item --no-unexp
50
51Take into account only propagated objects (attribute 'exported'=1) (default)
52
53=back
54
55=cut
56
57my $LA = LATMOS::Accounts->new($config, noacl => 1);
58my $labase = $LA->base($base);
59$labase && $labase->load or die "Cannot load base";
60
61$labase->unexported($nounexp ? 0 : 1);
62
63my $globalenv = LATMOS::Accounts::Cli::globalenv($labase);
64
65if (@ARGV) {
66    $globalenv->run(@ARGV);
67} else {
68    $globalenv->cli;
69}
70print "\n";
71
72exit 0;
73
Note: See TracBrowser for help on using the repository browser.