Make aliases be auto-detected and inserted into help texts.
FossilOrigin-Name: 6911ac8e0c1a62dbd2eb319ee83d953eae7f86312835f14cd81bf5ccdac06d39
This commit is contained in:
parent
5dc5417902
commit
89880e320d
1 changed files with 12 additions and 15 deletions
27
shelldap
27
shelldap
|
|
@ -304,8 +304,6 @@ copied and then an LDAP moddn() is performed.
|
||||||
copy uid=mahlon ou=Others,dc=example,o=company
|
copy uid=mahlon ou=Others,dc=example,o=company
|
||||||
copy uid=mahlon,ou=People,dc=example,o=company uid=mahlon,ou=Others,dc=example,o=company
|
copy uid=mahlon,ou=People,dc=example,o=company uid=mahlon,ou=Others,dc=example,o=company
|
||||||
|
|
||||||
aliased to: cp
|
|
||||||
|
|
||||||
=head2 create
|
=head2 create
|
||||||
|
|
||||||
Create an entry.
|
Create an entry.
|
||||||
|
|
@ -321,8 +319,6 @@ and added to the LDAP directory.
|
||||||
|
|
||||||
create top person organizationalPerson inetOrgPerson posixAccount
|
create top person organizationalPerson inetOrgPerson posixAccount
|
||||||
|
|
||||||
aliased to: touch
|
|
||||||
|
|
||||||
=head2 delete
|
=head2 delete
|
||||||
|
|
||||||
Remove an entry.
|
Remove an entry.
|
||||||
|
|
@ -335,8 +331,6 @@ for review before delete.
|
||||||
delete uid=ma*
|
delete uid=ma*
|
||||||
rm -v uid=mahlon,ou=People,dc=example,o=company l=office
|
rm -v uid=mahlon,ou=People,dc=example,o=company l=office
|
||||||
|
|
||||||
aliased to: rm
|
|
||||||
|
|
||||||
=head2 edit
|
=head2 edit
|
||||||
|
|
||||||
Edit an entry in an external editor.
|
Edit an entry in an external editor.
|
||||||
|
|
@ -347,8 +341,6 @@ directory.
|
||||||
|
|
||||||
edit uid=mahlon
|
edit uid=mahlon
|
||||||
|
|
||||||
aliased to: vi
|
|
||||||
|
|
||||||
=head2 env
|
=head2 env
|
||||||
|
|
||||||
Print values of configurable shelldap variables.
|
Print values of configurable shelldap variables.
|
||||||
|
|
@ -366,8 +358,6 @@ The search string must be a valid LDAP filter.
|
||||||
grep uid=mahlon ou=People
|
grep uid=mahlon ou=People
|
||||||
grep -r (&(uid=mahlon)(objectClass=*))
|
grep -r (&(uid=mahlon)(objectClass=*))
|
||||||
|
|
||||||
aliased to: search
|
|
||||||
|
|
||||||
=head2 inspect
|
=head2 inspect
|
||||||
|
|
||||||
View schema and flags for an entry or objectClass.
|
View schema and flags for an entry or objectClass.
|
||||||
|
|
@ -394,8 +384,6 @@ List directory contents.
|
||||||
|
|
||||||
Globbing is supported.
|
Globbing is supported.
|
||||||
|
|
||||||
aliased to: ls
|
|
||||||
|
|
||||||
ls -l
|
ls -l
|
||||||
ls -lR uid=mahlon
|
ls -lR uid=mahlon
|
||||||
list uid=m*
|
list uid=m*
|
||||||
|
|
@ -425,8 +413,6 @@ Move (rename) entry.
|
||||||
|
|
||||||
Usage is identical to B<copy>.
|
Usage is identical to B<copy>.
|
||||||
|
|
||||||
aliased to: mv
|
|
||||||
|
|
||||||
=head2 passwd
|
=head2 passwd
|
||||||
|
|
||||||
Change user password.
|
Change user password.
|
||||||
|
|
@ -2413,6 +2399,7 @@ sub run_inspect
|
||||||
local $| = 1;
|
local $| = 1;
|
||||||
my %aliases;
|
my %aliases;
|
||||||
|
|
||||||
|
# In first pass, only identify aliases.
|
||||||
while(my($cmd, $data) = each %cmd_map ) {
|
while(my($cmd, $data) = each %cmd_map ) {
|
||||||
# If command is an alias, it is enough to mark it as such.
|
# If command is an alias, it is enough to mark it as such.
|
||||||
if( $$data[0]) {
|
if( $$data[0]) {
|
||||||
|
|
@ -2420,7 +2407,12 @@ sub run_inspect
|
||||||
push @{$aliases{$$data[0]}}, $cmd;
|
push @{$aliases{$$data[0]}}, $cmd;
|
||||||
|
|
||||||
# If it is a real command, let's do more work.
|
# If it is a real command, let's do more work.
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# In second pass, deal with non-aliases.
|
||||||
|
while(my($cmd, $data) = each %cmd_map ) {
|
||||||
|
if( !$$data[0]) {
|
||||||
# If completer is defined, set it.
|
# If completer is defined, set it.
|
||||||
if( $$data[1]) {
|
if( $$data[1]) {
|
||||||
my $comp_sub = "comp_$cmd";
|
my $comp_sub = "comp_$cmd";
|
||||||
|
|
@ -2438,6 +2430,10 @@ sub run_inspect
|
||||||
$summary =~ s/\s+/ /s;
|
$summary =~ s/\s+/ /s;
|
||||||
}
|
}
|
||||||
my $help = join "\n", @pod;
|
my $help = join "\n", @pod;
|
||||||
|
if( $aliases{$cmd}) {
|
||||||
|
local $" = ', ';
|
||||||
|
$help .= "\n\n Aliases: @{$aliases{$cmd}}\n"
|
||||||
|
}
|
||||||
|
|
||||||
my $helpfunc = sub { "$help\n" };
|
my $helpfunc = sub { "$help\n" };
|
||||||
*{"help_$cmd"} = \&$helpfunc;
|
*{"help_$cmd"} = \&$helpfunc;
|
||||||
|
|
@ -2447,6 +2443,7 @@ sub run_inspect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# In third pass, actually register found aliases.
|
||||||
while(my($cmd,$aliases) = each %aliases) {
|
while(my($cmd,$aliases) = each %aliases) {
|
||||||
my $aliasfunc = sub { @$aliases };
|
my $aliasfunc = sub { @$aliases };
|
||||||
*{"alias_$cmd"} = \&$aliasfunc;
|
*{"alias_$cmd"} = \&$aliasfunc;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue