Skip to main content

complete_files_with_ext

Function complete_files_with_ext 

Source
pub fn complete_files_with_ext(
    prefix: &str,
    exts: &[&str],
    strip_ext: bool,
) -> Vec<String>
Expand description

List files under the directory implied by prefix, keeping only those whose extension is in exts (case-insensitive, without the dot).

  • prefix — what the user has typed so far (may include a dir part).
  • exts — allowed extensions, e.g. ["csv", "json"]. Empty = any.
  • strip_ext — when true, the extension is removed from the suggestion (cargo style: --example foo instead of foo.rs).

Directories are always suggested so the user can drill into them.