NAME

Complete::File - Completion routines related to files

VERSION

This document describes version 0.443 of Complete::File (from Perl distribution Complete-File), released on 2021-02-08.

DESCRIPTION

FUNCTIONS

complete_dir

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.

  • 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.

    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.

  • 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

Usage:

complete_file(%args) -> array

Complete file and directory from local filesystem.

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.

  • exclude_dir => bool

  • exclude_leaf => 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.

  • 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.

  • 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.

    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.

  • 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)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Complete-File.

SOURCE

Source repository is at https://github.com/perlancar/perl-Complete-File.

BUGS

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.

SEE ALSO

Complete

Other Complete::* modules.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

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.