[Last up date: 14/02/12]
[目次] >> [FreeBSD] >> [.complete]

onintr -
if (! $?prompt) goto end

set noglob
set hosts=(irc.media.kyoto-u.ac.jp \
	    irc.nara.wide.ad.jp \
	    irc.2ch.net \
	    irc.jaggler.net \

if ( -r $HOME/.netrc ) then
    set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
    set hosts=($hosts $f)
unset f

    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
    complete telnet 	p/1/\$hosts/ p/2/x:''/ n/*/n/

    complete cd  	p/1/d/		# Directories only
    complete chdir 	p/1/d/
    complete pushd 	p/1/d/
    complete popd 	p/1/d/
    complete pu 	p/1/d/
    complete po 	p/1/d/

    complete complete 	p/1/X/		# Completions only
    complete uncomplete	n/*/X/

    complete exec 	p/1/c/		# Commands only
#   complete sudo	p/1/c/
    complete which	n/*/c/
    complete where	n/*/c/

    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
    complete unset	n/*/s/

    complete alias 	p/1/a/		# only aliases are valid
    complete unalias	n/*/a/
    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
    complete dvips 	n/*/f:*.dvi/
    complete tex 	n/*/f:*.{tex,texi}/	# Files that match *.tex and *.texi
    complete latex 	n/*/f:*.{tex,ltx}/

    complete ps{nup,select}	n/*/f:*.{ps,PS}/

    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
		  	c/-/"(fstype name perm prune type user nouser \
		  	     group nogroup size inum atime mtime ctime exec \
			     ok print ls cpio ncpio newer xdev depth \
			     daystart follow maxdepth mindepth noleaf version \
			     anewer cnewer amin cmin mmin true false uid gid \
			     ilname iname ipath iregex links lname empty path \
			     regex used xtype fprint fprint0 fprintf \
			     print0 printf not a and o or)"/ \

    complete -%*	c/%/j/			# fill in the jobs builtin
    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//

    complete kill	'c/-/S/' 'c/%/j/' \
			'n/*/`ps -U $LOGNAME | awk '"'"'{print $1}'"'"'`/'

    complete finger	c/*@/\$hosts/ n/*/u/@ 
    complete ping	p/1/\$hosts/
    complete traceroute	p/1/\$hosts/
    complete ssh	p/1/\$hosts/

    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/

    complete printenv	'n/*/e/'
    complete setenv	'p/1/e/' 'c/*:/f/'

    complete cvs	'c/--/(help help-commands help-synonyms)/' \
			'p/1/(add admin annotate checkout commit diff \
			edit editors export history import init log login \
			logout rdiff release remove rtag status tag unedit \
			update watch watchers)/' 'n/-a/(edit unedit commit \
			all none)/' 'n/watch/(on off add remove)/'

    complete ghostview	'p/*/f:*.ps/'
    complete gv		'p/*/f:*.ps/'
    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
			mtu vlandev vlan metric mediaopt down delete \
			broadcast arp debug)/'

    complete ipfw 	'p/1/(flush add delete list show zero)/' \
			'n/add/(allow permit accept pass deny drop reject \
			reset count skipto num divert port tee port)/'

    complete chown	c/--/"(changes dereference no-dereference silent \
    			quiet reference recursive verbose help version)"/ \
			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
			n/-/u/: p/1/u/: n/*/f/

    complete chmod	c/--/"(changes silent quiet verbose reference \
    			recursive help version)"/ c/-/"(c f R v)"/
    complete df		c/--/"(all block-size human-readable si inodes \
			kilobytes local megabytes no-sync portability sync \
			type print-type exclude-type help version)"/ \
			c/-/"(a H h i k l m P T t v x)"/
    complete du		c/--/"(all block-size bytes total dereference-args \
    			human-readable si kilobytes count-links dereference \
			megabytes separate-dirs summarize one-file-system \
			exclude-from exclude max-depth help version"/ \
			c/-/"(a b c D H h k L l m S s X x)"/

    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
			show-nonprinting show-ends show-tabs help version)"/ \
			c/-/"(A b E e n s T t u v -)"/ n/*/f/
    complete mv		c/--/"(backup force interactive update verbose suffix \
			version-control help version)"/ \
			c/-/"(b f i S u V v -)"/ \
			n/{-S,--suffix}/x:''/ \
			n/{-V,--version-control}/"(t numbered nil existing \
			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
    complete cp		c/--/"(archive backup no-dereference force \
    			interactive link preserve parents sparse recursive \
			symbolic-link suffix update verbose version-control \
			one-file-system help version)"/ \
			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
			n/-*r/d/ n/{-S,--suffix}/x:''/ \
			n/{-V,--version-control}/"(t numbered nil existing \
			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
    complete ln		c/--/"(backup directory force no-dereference \
    			interactive symbolic suffix verbose version-control \
			help version)"/ \
			c/-/"(b d F f i n S s V v -)"/ \
			n/{-S,--suffix}/x:''/ \
			n/{-V,--version-control}/"(t numbered nil existing \
			never simple)"/ n/-/f/ N/-/x:''/ \
			p/1/f/ p/2/x:''/
    complete touch	c/--/"(date reference time help version)"/ \
			c/-/"(a c d f m r t -)"/ \
			n/{-d,--date}/x:''/ \
			c/--time/"(access atime mtime modify use)"/ \
			n/{-r,--file}/f/ n/-t/x:''/ n/*/f/
    complete mkdir	c/--/"(mode parents verbose help version)"/ \
    			c/-/"(p m -)"/ \
			n/{-m,--mode}/x:''/ n/*/d/
    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
    			version)"/ c/-/"(p -)"/ n/*/d/
    complete env 	'c/*=/f/' 'p/1/e/=/' 'p/2/c/'

    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
			R S T v V w W X z Z)"/ \
			c/-[dtx]*/"( B C f F g G i k K m M O p P \
			R s S T v w x X z Z)"/ \
			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
			--catenate --concatenate --create --diff --compare \
			--delete --append --list --update --extract --get \
			--help --version)"/ \
			c/--/"(catenate concatenate create diff compare \
			delete append list update extract get atime-preserve \
			block-size read-full-blocks directory checkpoint file \
			force-local info-script new-volume-script incremental \
			listed-incremental dereference ignore-zeros \
			ignore-failed-read keep-old-files starting-file \
			one-file-system tape-length modification-time \
			multi-volume after-date newer old-archive portability \
			to-stdout same-permissions preserve-permissions \
			absolute-paths preserve record-number remove-files \
			same-order preserve-order same-owner sparse \
			files-from null totals verbose label version \
			interactive confirmation verify exclude exclude-from \
			compress uncompress gzip ungzip use-compress-program \
			block-compress help version)"/ \
			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
			C@/dev@f@ \
			n/-c*f/x:''/ \
			n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
			n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
			n/{-[Adrtux]*f,--file}/f:*.tar/ \
			N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
			N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
			n/--use-compress-program/c/ \
			n/{-b,--block-size}/x:''/ \
			n/{-V,--label}/x:''/ \
			n/{-N,--{after-date,newer}}/x:''/ \
			n/{-L,--tape-length}/x:''/ \
			n/{-C,--directory}/d/ \
			N/{-C,--directory}/'`\ls $:-1`'/ \
			n/-[0-7]/"(l m h)"/

    # BSD 4.3 filesystems
    complete  mount	c/-/"(a d f p r u v w)"/ n/-t/"(ufs nfs msdosfs smbfs)"/ \
    			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	" | cut -f 2`'@
    complete umount	c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
    			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
    			n/*/'`mount | cut -d " " -f 3`'/
    # BSD 4.2 filesystems
    #complete  mount	c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
    #			n@*@'`cut -d ":" -f 2 /etc/fstab`'@
    #complete umount	c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
    #			n/*/'`mount | cut -d " " -f 3`'/

    # these deal with NIS (formerly YP); if it's not running you don't need 'em
    if (-X domainname) then
      set _domain = "`domainname`"
      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
      if ("$_domain" != "" && "$_domain" != "noname") then
        complete domainname p@1@D:$_ypdir@" " n@*@n@
        complete ypcat	    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
	                    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
	                    N@-d@x:''@ n@-@x:''@ p@1@x:''@ \
	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
	                    n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
			    N@-m@n@ n@*@\$hosts@
      unset _domain _ypdir

    complete make  'p/1/(all clean distclean depend install search)/'

    if ( -f /etc/printcap ) then
	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)

	complete lpr    'c/-P/$printers/'
	complete lpq    'c/-P/$printers/'
	complete lprm   'c/-P/$printers/'
	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
	complete dvilj	'p/*/f:*.dvi/'

if ($?PORTSDIR == 0) then
    setenv PORTSDIR /usr/ports

if ($?PKG_DBDIR == 0) then
    setenv PKG_DBDIR /var/db/pkg

complete pkg_create "n@-b@D:$PKG_DBDIR@@"
complete pkg_deinstall "p@*@D:$PKG_DBDIR@@"
complete pkg_fetch 'p@*@`ls $PKG_DBDIR | sed "s,\(.*\)-.*,\1," `@@'
complete pkg_which "c@*@D:$PKG_DBDIR@@" "o@*@D:$PKG_DBDIR@@"
complete pkgdb "c@*@D:$PKG_DBDIR@@" "o@*@D:$PKG_DBDIR@@"
complete portinstall "p@*@D:$PORTSDIR@"
complete ports_glob "p@*@D:$PORTSDIR@"
complete portupgrade "n@-o@D:$PORTSDIR@" "p@*@D:$PKG_DBDIR@@"
complete portversion "p@*@D:$PKG_DBDIR@@"
complete portmaster "n@-o@D:$PORTSDIR@" "p@*@D:$PKG_DBDIR@@"

complete sudo p/1/c/ "n@portupgrade@D:$PKG_DBDIR@@"
complete sudo p/1/c/ "n@portmaster@D:$PKG_DBDIR@@"

unset noglob
unset printers


Counter image