Useless hack of the day

Taken from the Common TCSH Completions page, with a little bit of hackery to get a reasonable host list:

set ssh_hostlist=( `cut -f1 -d' ' ~/.ssh/known_hosts | cut -f1 -d',' | xargs`)

complete ssh 'p/1/$ssh_hostlist/' 'p/2/c/'
# rcp and scp allow arguments to be references to either local or remote
# files.  It's impossible to complete remote files, but its useful to assume
# that the remote file structure is similar to the local one.
#
# when you first start typing, it could be any of a username, hostname,
# or filename.  But filename is probably the most useful case, so:
#
# complete arguments as regular filenames, with following exceptions
# if "@" has been typed, complete with a hostname, and append a colon (:)
# if ":" has been typed, complete with a filename relative to home directory
# if ":/" has been typed, complete with a filename relative to root directory
# 
complete scp "c,*:/,F:/," "c,*:,F:$HOME," 'c/*@/$ssh_hostlist/:/'