lemonldap-ng/lemonldap-ng-common/scripts/lemonldap-ng-cli
2016-02-06 12:22:10 +00:00

47 lines
1.2 KiB
Perl
Executable File

#!/usr/bin/env perl
use warnings;
use strict;
my $action;
for ( my $i = 0 ; $i < @ARGV ; $i++ ) {
if ( $ARGV[$i] =~ /^-/ ) {
$i++;
next;
}
$action = $ARGV[$i];
last;
}
if ( $action =~ /^(?:[gs]et|(?:add|del)Key)$/ ) {
eval { require Lemonldap::NG::Manager::Cli; };
die 'Manager libraries not available, aborting' if ($@);
Lemonldap::NG::Manager::Cli->run(@ARGV);
}
elsif ( $action =~ /^(?:info|update-cache)$/ ) {
eval { require Lemonldap::NG::Common::Cli; };
die "Lemonldap::NG common libraries not available, aborting ($@)" if ($@);
Lemonldap::NG::Common::Cli->run(@ARGV);
}
else {
help();
}
sub help {
print STDERR qq{Usage: $0 <options> action <parameters>
Available actions:
- help : print this
- info : get currentconfiguration info
- update-cache : force configuration cache to be updated
- get <keys> : get values of parameters
- set <key> <value> : set parameter(s) value(s)
- addKey <key> <subkey> <value> : add or set a subkey in a parameter
- delKey <key> <subkey> : delete subkey of a parameter
See Lemonldap::NG::Common::Cli(3) or Lemonldap::NG::Manager::CLi(3) for more
};
}