Skip to content
Snippets Groups Projects
Commit 5791260e authored by Robert Spencer's avatar Robert Spencer
Browse files

Display a menu if there are multiple options

parent 80a46603
No related branches found
No related tags found
1 merge request!8Display a menu if there are multiple options
...@@ -200,12 +200,20 @@ if ($ldapNumResults < 1) { ...@@ -200,12 +200,20 @@ if ($ldapNumResults < 1) {
$ldapEntry = $ldapResults[0]; $ldapEntry = $ldapResults[0];
} elsif ($ldapNumResults > 1) { } elsif ($ldapNumResults > 1) {
my $counter = 1;
logger('WARNING',color('red')."Found multiple entries!".color('reset')); logger('WARNING',color('red')."Found multiple entries!".color('reset'));
foreach my $key (keys %{$mesg->as_struct()}) print STDERR "\n";
{ foreach my $key (sort(keys %{$mesg->as_struct()})) {
logger('WARNING'," ".color('red')."%s".color('reset'),$key); logger('MENU '.$counter," ".color('red')."%s".color('reset'),$key);
$counter++;
}
print STDERR "Your selection: ";
chomp(my $menuSelection = <STDIN>);
if ($menuSelection =~ /\D/) {
exit 3;
} }
exit 3; $menuSelection--;
$ldapEntry = $ldapResults[$menuSelection];
} }
print STDERR "\n"; print STDERR "\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment