Closed nkh closed 12 years ago
Please reduce this to a smaller program that doesn't have the "fluff" and doesn't have a dependency on Tree::Trie. Also, please indicate the column width value.
Even better would be to create a test case that fails. See t/04.columnize.t for a guide on writing a test case.
Thanks.
You're on your own then. I will use my own code.
I can' be difficult to find the one only line where you module is called, the rest can be ignored as I told you.
On Thu, Nov 10, 2011 at 8:55 PM, R. Bernstein < reply@reply.github.com>wrote:
Please reduce this to a smaller program that doesn't have the "fluff" and doesn't have a dependency on Tree::Trie. Also, please indicate the column width value.
Even better would be to create a test case that fails. See t/04.columnize.t for a guide on writing a test case.
Thanks.
Reply to this email directly or view it on GitHub: https://github.com/rocky/Perl-Array-Columnize/issues/2#issuecomment-2700244
Will reconsider when we have a proper bug report.
I ran the test in your distribution "perl columnize.pm" and that works
Here is a script (you can ignore the fluff), it outputs the same @matches.
I believe that it is because you do not use the whole terminal width and in this very case the output cells are already pretty large.
$> pbs_perl_completion.pl 0 pbs --serv%
!/usr/bin/env perl
=pod
Add the following line in your I<~/.bashrc> or B
_pbs_perl_completion() { local old_ifs="${IFS}" local IFS=$'\n'; COMPREPLY=( $(pbs_perl_completion.pl ${COMP_CWORD} ${COMP_WORDS[@]}) ); IFS="${old_ifs}"
return 1; }
complete -o default -F _pbs_perl_completion pbs
Replace I with the name you saved the script under. The script has to
be executable and somewhere in the path.
I received from bash:
=over 2
=item * $index - index of the command line argument to complete (starting at '1')
=item * $command - a string containing the command name
=item * \@argument_list - list of the arguments typed on the command line
=back
You return possible completion you want separated by I<\n>. Return nothing if you want the default bash completion to be run which is possible because of the <-o defaul> passed to the B command.
Note! You may have to re-run the B command after you modify your perl script.
=cut
use strict; use Tree::Trie;
my @completions = qw( -h --h -help --help -post_pbs --post_pbs -evaluate_shell_command_verbose --evaluate_shell_command_verbose -use_watch_server --use_watch_server -watch_server_double_check_with_md5 --watch_server_double_check_with_md5 -watch_server_verbose --watch_server_verbose -display_simplified_rule_transformation --display_simplified_rule_transformation -tnonh --tnonh -tnonr --tnonr ) ;
my($trie) = new Tree::Trie; $trie->add(@completions) ;
my ($argument_index, $command, @arguments) = @ARGV ;
$argument_index-- ; my $word_to_complete = $arguments[$argument_index] ;
if(defined $word_to_complete) { if($word_to_complete =~ /%$/) { my ($search_type) = $word_to_complete =~ /(%+)$/ ;
my ($prefix) = $word_to_complete =~ /^(-+)/ ;
~ else