# HG changeset patch # User Davor Ocelic # Date 1557044058 -7200 # Node ID 6a0b1209dafa4c4adfe961bb16c216d846838dc6 # Parent 5ace587c3ea31009ae9d9d1598b55d301efcab8b Support arrays/hashes in 'env' (WIP) - 'env' now prints 'attributes' array - 'env' output now supports any data type, not just strings - option --attributes on command line properly overrides config values The remaining thing to do is to support 'setenv' to work with non-strings too. diff -r 5ace587c3ea3 -r 6a0b1209dafa shelldap --- a/shelldap Sun May 05 09:54:28 2019 +0200 +++ b/shelldap Sun May 05 10:14:18 2019 +0200 @@ -624,7 +624,7 @@ $self->{'editor'} = $conf->{'editor'} || $ENV{'EDITOR'} || 'vi'; $self->{'pager'} = $conf->{'pager'} || $ENV{'PAGER'} || 'less'; - $self->{'env'} = [ qw/ debug cacheage timeout / ]; + $self->{'env'} = [ qw/ debug cacheage timeout attributes / ]; # let autocomplete work with the '=' character my $term = $self->term(); @@ -2075,11 +2075,8 @@ { my $self = shift; - foreach ( sort @{ $self->{'env'} } ) { - print "$_: "; - print $conf->{$_} ? $conf->{$_} : 0; - print "\n" - } + print YAML::Syck::Dump( { map { $_, $conf->{$_}} sort @{ $self->{'env'}} } ); + print "\n" } @@ -2659,7 +2656,7 @@ 'binddn|D=s', 'basedn|b=s', 'cacheage=i', - 'attributes=s@', + 'cmdline_attributes|attributes=s@', 'paginate=i', 'promptpass|W', 'timeout=i', @@ -2696,6 +2693,11 @@ $conf->{'timeout'} ||= 10; $conf->{'attributes'} ||= ['*']; +# Allow command line option --attributes to override settings from +# config file. +if($conf->{'cmdline_attributes'}) { + $conf->{'attributes'} = $conf->{'cmdline_attributes'} +} # create and enter shell loop while also handling Ctrl+C correctly. my $shell = LDAP::Shell->new;