Append a trailing slash to entries that contain other entries. Thanks
to Jonathan Rozes <jonathan@laika.com> for the idea, and Michael Granger <ged@faeriemud.org> for telling me about the hasSubordinates attribute (that he was already using to do exactly this in the Treequel-based ruby shell, heh!) FossilOrigin-Name: 0ba6d54560597cf729b319c54229a6331218cd31d18e7e0edddfa5f132480c3d
This commit is contained in:
parent
7885c220b5
commit
29f2cdb50c
1 changed files with 14 additions and 3 deletions
15
shelldap
15
shelldap
|
|
@ -1402,8 +1402,12 @@ sub run_list
|
||||||
$long = $flags =~ /l/;
|
$long = $flags =~ /l/;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $s = $self->search({ scope => $recurse ? 'sub' : 'one',
|
my $s = $self->search({
|
||||||
vals => $long, filter => $filter });
|
scope => $recurse ? 'sub' : 'one',
|
||||||
|
vals => 1,
|
||||||
|
filter => $filter,
|
||||||
|
attrs => [ '*', 'hasSubordinates' ]
|
||||||
|
});
|
||||||
if ( $s->{'code'} ) {
|
if ( $s->{'code'} ) {
|
||||||
print "$s->{'message'}\n";
|
print "$s->{'message'}\n";
|
||||||
return;
|
return;
|
||||||
|
|
@ -1429,6 +1433,13 @@ sub run_list
|
||||||
my $dn;
|
my $dn;
|
||||||
foreach my $e ( sort { $a->dn() cmp $b->dn() } @{ $s->{'entries'} } ) {
|
foreach my $e ( sort { $a->dn() cmp $b->dn() } @{ $s->{'entries'} } ) {
|
||||||
$dn = $e->dn();
|
$dn = $e->dn();
|
||||||
|
|
||||||
|
# if this entry is a container for other entries, append a
|
||||||
|
# trailing slash.
|
||||||
|
if ( $e->get_value('hasSubordinates') eq 'TRUE' ) {
|
||||||
|
$dn .= '/';
|
||||||
|
}
|
||||||
|
|
||||||
my $rdn = $dn;
|
my $rdn = $dn;
|
||||||
$rdn =~ s/,$base//i;
|
$rdn =~ s/,$base//i;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue