#compdef telnet # Parameter used: # # telnet_hosts_ports_users # The array that contains 3-tuples `host:port:user'. local state line expl typeset -A options _arguments -s \ -{F,f,x} \ '-8[allow 8-Bit data]' \ '-E[disable an escape character]' \ '-K[no automatic login]' \ '-L[allow 8-Bit data on output]' \ '-S+:IP type-of-service:' \ '-X+:authentication type to disable:' \ '-a[attempt automatic login]' \ '-c[disable .telnetrc]' \ '-d[debug mode]' \ '-e+[specify escape character]:escape character:' \ '-k+:realm:' \ '-l+[specify user]:user:->users' \ '-n+[specify tracefile]:tracefile:_files' \ '-r[rlogin like user interface]' \ ':host:->hosts' \ ':port:->ports' case "$state" in hosts) _description expl 'host' _combination telnet_hosts_ports_users \ ${options[-l]:+users=${options[-l]:q}} \ hosts "$expl[@]" ;; ports) _description expl 'port' _combination telnet_hosts_ports_users \ ${options[-l]:+users=${options[-l]:q}} \ hosts="${line[2]:q}" \ ports "$expl[@]" ;; users) _description expl 'user' _combination telnet_hosts_ports_users \ ${line[2]:+hosts="${line[2]:q}"} \ ${line[3]:+ports="${line[3]:q}"} \ users "$expl[@]" ;; esac