Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sudo rpm -e completion b0rken

On Nov 21,  8:35pm, Alexey I. Froloff wrote:
} Completion for rpm -e is broken (completes local files, not
} packages) when it's going to be executed under sudo.

It's not rpm completion that's broken, it's sudo completion, which
believes that the -e is an option of sudo itself.

   -e   The -e (edit) option indicates that, instead of running a
        command, the user wishes to edit one or more files. In lieu of
        a command, the string "sudoedit" is used when consulting the
        sudoers file.

_sudo has:

if [[ $service = sudoedit || -n $words[(R)-e] ]]; then
    '*:file: _files'

The file names don't have to directly follow the -e and there are a
bunch of other options that have their own arguments and that may be
used both with and withou -e, so it's not as trivial as this pretends
to determine where the command begins and the sudo options end.

It'd probably require using the _arguments state machine to get this
right; I'm not sure it's worth the effort for this one special case.

Messages sorted by: Reverse Date, Date, Thread, Author