[Bash-completion-devel] [PATCH][bash-completion-Bugs][311403] DBTS 501837: don't use uname for pidof completion, just check for its presence

Ville Skyttä ville.skytta at iki.fi
Tue Nov 15 20:57:08 UTC 2011


On 11/15/2011 11:24 PM, Igor Murzov wrote:
> Proposed patch for Alioth #311403:

Looks fine to me.  My pidof doesn't have --usage either and apparently
there's no way to get it to output a usage message but I supose the
_parse_help doesn't hurt, but it has one argument that could be
completed, from the man page:

	-o omitpid
              Tells pidof to omit processes with that process id. [...]

...so I'd add something like:

> index 0000000..5964922
> --- /dev/null
> +++ b/completions/pidof
> @@ -0,0 +1,17 @@
> +# pidof(8) completion                                      -*- shell-script -*-
> +
> +_pidof()
> +{
> +    local cur prev words cword
> +    _init_completion || return
> +

case $prev in
    -o)
        _pids
        return
        ;;
esac

> +    if [[ $cur == -* ]]; then
> +        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
> +        return
> +    fi
> +
> +    _pnames
> +} &&
> +complete -F _pidof pidof



More information about the Bash-completion-devel mailing list