Skip to content

Fall back to _filedir, compgen -f, etc. if no matches are returned #4

@beaugunderson

Description

@beaugunderson

Programs that use omelette completion can no longer complete files and directories. I modified my completion script to fall back to _filedir (it relies on the $cur and $prev variables):

  _p_complette() {
    local cur prev

    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}

    COMPREPLY=( $(compgen -W '$(projects --compbash --compgen "${COMP_CWORD}" "${prev}" "${COMP_LINE}")' -- "$cur") )

    [[ $COMPREPLY ]] && return

    _filedir
  }
  complete -F _p_complette p

In the same way compgen -f with compopt -o filenames could be used, I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions