Thread readline history (11 answers)
Opened by Kuerbis at 2022-06-23 16:23

Kuerbis
 2022-06-23 16:23
#194381 #194381
User since
2011-03-20
942 Artikel
BenutzerIn
[default_avatar]
Hallo,

wenn hier eine history übergeben wird, sollte dann readline doppelte Einträge automatisch herausfiltern, oder sollte es dem User überlassen werden, doppelte Einträge herauszufiltern?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
use Term::Form::ReadLine;

my $rl = Term::Form::ReadLine->new();

my $history = [ 'a', 'b', 'c' ];
my $line = $rl->readline( 'Prompt: ', { history => $history } );
exit if ! length $line;
push @$history, $line;
$line = $rl->readline( 'Prompt: ', { history => $history } );

View full thread readline history