Suppose you have a CLI named process-users that accepts some
command-line options and arguments. To add tab completion for
process-users, write _process-users as follows:
#!/usr/bin/env perl
use Shell::Completer;
declare_completer(
options => {
'help|h' => undef, # no completion, no option value
'verbose!' => undef, #
'on-fail=s' => ['skip', 'die'], # complete from a list of words
'template=s' => _file(file_ext_filter=>['tmpl', 'html']),
# complete from *.tmpl or *.html files
'<>' => _user(), # complete from list of users
},
);