# HG changeset patch # User Davor Ocelic # Date 1556480406 -7200 # Node ID cb4de2ecc7ab2988cb607acc7bdaf677c8af2980 # Parent 5975875d67b844a478da56b98ff58ec01fc44f21 Allow default attributes to be set via config and cmdline This commit changes the default attribute list from a fixed '*' to a configurable list, defaulting to ['*']. It allows one to use config file or command line to set default attributes to retrieve and display - i.e. to set default attributes to '+' or to a list of multiple specific attributes. Printing or changing this value through env/setenv is currently not supported because env/setenv only work properly with string values while attributes is a list. diff -r 5975875d67b8 -r cb4de2ecc7ab shelldap --- a/shelldap Mon Apr 15 14:18:12 2019 -0700 +++ b/shelldap Sun Apr 28 21:40:06 2019 +0200 @@ -1437,7 +1437,7 @@ { my $self = shift; my $dn = shift; - my @attrs = (@_) ? @_ : ('*'); + my @attrs = (@_) ? @_ : @{$conf->{'attributes'}}; $self->display( $dn, \@attrs, 0 ); } @@ -2381,6 +2381,7 @@ 'binddn|D=s', 'basedn|b=s', 'cacheage=i', + 'attributes=s@', 'paginate=i', 'promptpass|W', 'timeout=i', @@ -2413,8 +2414,9 @@ # defaults $conf->{'configfile'} ||= "$ENV{'HOME'}/.shelldap.rc"; -$conf->{'cacheage'} ||= 300; -$conf->{'timeout'} ||= 10; +$conf->{'cacheage'} ||= 300; +$conf->{'timeout'} ||= 10; +$conf->{'attributes'} ||= ['*']; # create and enter shell loop my $shell = LDAP::Shell->new();