-1

I need to complete only first level (depth 1) files in given path, and ignore directories. I tried specifying -g '*(.)' but that seems to have no effect:

#compdef foo

 local state

_arguments -S : \
    '-i' \
    '-l' \
    '-w' \
    '1: :->myfiles'

 case $state in
    myfiles)
        _files -W /foo/bar -g '*(.)'
        ;;
 esac

it still shows files and directories.

How can I show first level files only ? I am not interested in files that might be in that directories at deeper levels.

0

1 Answer 1

2
_arguments -S : \
    '-i' \
    '-l' \
    '-w' \
    '1: :{
      _wanted all-files expl descriptiongoeshere compadd - /foo/bar/*(^/:t)
    }'

Not the answer you're looking for? Browse other questions tagged .