summaryrefslogtreecommitdiff
path: root/dirsh
blob: b48a2e59c945c84262b5016dddd54b2471e9aad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env perl

use lib './blib/lib/';
use LDAPShell;
use Getopt::Long;

my $usage=<<EOU;
Usage: $0

$0 is a command-line shell for administration of directory-based information.
Using $0 it is possible to add, delete and modify entries in a directory. The
shell presents a filesystem-like interface (with some support for tab-completion
of directory names) to a directory server.

$0 always runs over a secure connection (using TLS) and will not start unless
the START_TLS extended operation is supported by the directory server.

$0 implements a basic set of unix-like command look-alikes (cd,ls,pwd etc)
together with a few ldap-specific commands (modify,add,delete) and add-ons which
perform specific tasks (for instance the 'user' command which looks up a user based
on the 'uid' attribute).

$0 supports the notion of basic batch-file like scripts. These script are simply
lines which are executed one line at a time with simple substitution of command
line arguments from the batch-file call (%{0} is the first variable etc etc). Such
scripts can be used to automate tasks (creating new users, gropus, or adding members
to groups for instance).

EOU

my %args = ('verbose'=>0,'help'=>0);
my @args = ("config=s","verbose+","help!","template=s");
GetOptions(\%args,@args) or die $usage;
die $usage if $args{help};

my $shell = LDAPShell->new($ini);
$shell->loop();