daverowntree has asked for the wisdom of the Perl Monks concerning the following question:
TIA!use Term::ReadLine; my @commands = qw(one two three four five six seven eight nine ten); my $term = Term::ReadLine->new('test'); if (my $attr = $term->Attribs) { my $pkg = Term::ReadLine->ReadLine(); print "package is $pkg\n"; $term->ornaments(0); $attr->{basic_word_break_characters} = ". \t\n"; $attr->{completer_word_break_characters} = " \t\n"; $attr->{completion_function} = \&complete_word; $attr->{completion_suppress_append} = 1; # doesn't work! :( $attr->{completion_append_character} = "\0"; # nor this } while (1) { my $Command = $term->readline("Cmd>"); print "command:>$Command<\n"; } sub complete_word { my ($text, $line, $start) = @_; return grep(/^$text/, @commands); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: term::readline::gnu extra spaces on completion
by Eily (Monsignor) on Feb 03, 2014 at 17:38 UTC | |
by daverowntree (Initiate) on Feb 04, 2014 at 09:34 UTC | |
by Eily (Monsignor) on Feb 04, 2014 at 10:19 UTC | |
by daverowntree (Initiate) on Feb 04, 2014 at 14:53 UTC |