I am using the Term::Shell package in Perl for implementing a CLI tool. I am not able to do the tab completion of a command part with that.
comp_CMD() - which is a API provided by this Term::Shell, is to achieve the tab completion. This is not helping me. Does anyone know how to make this work??
Sample Code:
#!/usr/bin/env perl
package Sample;
use base qw(Term::Shell);
sub prompt_str { "Sample\>" };
sub comp_show
{
my $o = shift;
my $word = shift;
$o->completions($word, [qw(all work and no play is no fun at)]);
}
sub run_show
{
print "run show\n";
}
package main;
Sample->new->cmdloop;
This is a run of the program:
Sample>show[TAB]
The above command doesnt give the expected output.. it just gives me a tab.