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

Re: run-help-ip heler



On Wed, 12 Nov 2014 16:58:29 +0300
Artur Penttinen <arto-p@xxxxxxxxx> wrote:
>                                   Hello!
> 
>   In attach run-help helper for linux's ip command, simply copy it to your
>   $fpath and run
> 
>     autoload -Uz run-help-ip
> 
>   After that you can use run-help command for getting man
>   for certain ip subcommands:

Thanks --- I don't have the subcommand manual entries, so it might be
best to do a sanity check first, in case people are loading all run-help
helpers automatically...

pws


#! zsh -f
#
# Install this function by placing it in your FPATH and then
# adding to your .zshrc the line if you use run-help function:
#       autoload -Uz run-help-ip

if [ $# -eq 0 ]; then
    man ip
    return
fi

if ! man -w ip-address >/dev/null 2>&1; then
    man ip
    return
fi

while [[ $# != 0 && $1 == -* ]]; do
    shift
done

case $1 in
    (addr*) man ip-address ;;
    (addrlabel) man ip-addrlabel ;;
    (l2*) man ip-l2tp ;;
    (li*) man ip-link ;;
    (ma*) man ip-maddress ;;
    (mo*) man ip-monitor ;;
    (mr*) man ip-mroute ;;
    (nei*) man ip-neighbour ;;
    (netc*) man ip-netconf ;;
    (netn*) man ip-netns ;;
    (nt*) man ip-ntable ;;
    (ro*) man ip-route ;;
    (ru*) man ip-rule ;;
    (tcp*) man ip-tcp_metrics ;;
    (to*) man ip-token ;;
    (tu*) man ip-tunnel ;;
    (xf*) man ip-xfrm ;;
    (*) man ip ;;
esac

return $?



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