Complete::File - Completion routines related to files
This document describes version 0.443 of Complete::File (from Perl distribution Complete-File), released on 2021-02-08.
Usage:
complete_dir(%args) -> array
Complete directory from local filesystem (wrapper for complete_dir() that only picks directories).
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
allow_dot => bool (default: 1)
If turned off, will not allow "." or ".." in path.
This is most useful when combined with starting_path option to prevent user going up/outside the starting path.
starting_path
exclude_leaf => bool
filter => str|code
Only return items matching this filter.
Filter can either be a string or a code.
For string filter, you can specify a pipe-separated groups of sequences of these characters: f, d, r, w, x. Dash can appear anywhere in the sequence to mean not/negate. An example: f means to only show regular files, -f means only show non-regular files, drwx means to show only directories which are readable, writable, and executable (cd-able). wf|wd means writable regular files or writable directories.
f
-f
drwx
wf|wd
For code filter, you supply a coderef. The coderef will be called for each item with these arguments: $name. It should return true if it wants the item to be included.
$name
handle_tilde => bool (default: 1)
recurse => bool
recurse_matching => str (default: "level-by-level")
starting_path => str (default: ".")
word* => str (default: "")
Word to complete.
Return value: (array)
complete_file(%args) -> array
Complete file and directory from local filesystem.
exclude_dir => bool
file_ext_filter => re|array[str]
This is also an alternative to specifying full filter or file_regex_filter. You can set this to a regex or a set of extensions to accept. Note that like in file_regex_filter, directories of any name is also still allowed.
filter
file_regex_filter
file_regex_filter => re
Filter shortcut for file regex.
This is a shortcut for constructing a filter. So instead of using filter, you use this option. This will construct a filter of including only directories or regular files, and the file must match a regex pattern. This use-case is common.
Please visit the project's homepage at https://metacpan.org/release/Complete-File.
Source repository is at https://github.com/perlancar/perl-Complete-File.
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-Complete-File/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Complete
Other Complete::* modules.
Complete::*
perlancar <perlancar@cpan.org>
This software is copyright (c) 2021, 2019, 2017, 2016, 2015 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Complete::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Complete::File
CPAN shell
perl -MCPAN -e shell install Complete::File
For more information on module installation, please visit the detailed CPAN module installation guide.