I use the Term :: Shell package in Perl to implement the CLI tool. I cannot complete tab completion with part of a command.
comp_CMD () is the API provided by this Term :: Shell, is to achieve tab completion. This does not help me. Does anyone know how to make this work?
Code example:
#!/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 the launch of the program:
Sample>show[TAB]
The above command does not give the expected result .. it just gives me a tab.
Anandan
source share