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

Last change on this file was 2596, checked in by nanardon, 5 months ago

Fix: set login user in la-cli

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8use LATMOS::Accounts::Cli::Context;
9use LATMOS::Accounts::Cli;
10
11=head1 NAME
12
13    la-cli - A powerfull commandline tool to manage LATMOS::Accounts contents
14
15=head1 SYNOPSIS
16
17    la-cli [options]
18
19=cut
20
21GetOptions(
22    'c|config=s'        => \my $config,
23    'b|base=s'          => \my $base,
24    't|transaction'     => \my $transmode,
25    'no-unexp|wo-unexp' => \my $nounexp,
26    'with-unexp'        => \my $unexp,
27    'u|username=s'      => \my $username,
28    'acls'              => \my $acls,
29    'help'              => sub { pod2usage(0) },
30) or pod2usage();
31
32=head1 OPTIONS
33
34=over 4
35
36=item -c|--config configdir
37
38Use this configuration directory instead of the default one.
39
40=item -b|--base basename
41
42Query this specific base instead of the default one.
43
44=item -t|--transaction
45
46Enable transaction mode: don't commit at earch command
47
48=item --unexp
49
50Take into account all objects (even non propagated ones, with attribute 'exported'=0)
51
52=item --no-unexp
53
54Take into account only propagated objects (attribute 'exported'=1) (default)
55
56=item -u|--username USER
57
58Simulated access like user USER is login
59
60=item alcs
61
62Load acls
63
64=back
65
66=cut
67
68my $LA = LATMOS::Accounts->new($config, noacl => ! $acls, username => $username );
69my $labase = $LA->base($base);
70$labase && $labase->load or die "Cannot load base";
71
72$labase->unexported($nounexp ? 0 : 1);
73
74my $Context = LATMOS::Accounts::Cli::Context->new(
75    La => $LA,
76    base => $labase,
77    TransMode => $transmode ? 1 : 0,
78);
79
80my $Env = LATMOS::Accounts::Cli->new(
81    Context => $Context,
82);
83
84if (@ARGV) {
85    $Context->Interractive( 0 );
86    $Env->run(@ARGV);
87} else {
88     $Env->topCli;
89}
90print "\n";
91
92exit 0;
93
Note: See TracBrowser for help on using the repository browser.