* completion for (u)mount
@ 1998-01-20 4:33 Stefan Monnier
1998-01-20 4:45 ` Timothy J Luoma
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 1998-01-20 4:33 UTC (permalink / raw)
To: zsh-users
I just hacked up comletion for mount and umount on Linux. I figured some
completion fanatics might like it.
Stefan
comp_fsmount () {
local tmp; if [[ $UID = 0 ]]; then tmp=""; else tmp="user"; fi
sed -n -e "s|^[^# ][^ ]*[ ][ ]*\(/[^ ]*\)[
].*$tmp.*|\1|p" /etc/fstab # beware the tabs
}
comp_nfsmount () {
local cmd args host
read -Ac cmd; read -cn where
host=${${cmd[$where]}%%:*}
reply=("${(@f)$(showmount -e $host | sed -n -e "s|^/\([^ ]*\) .*|$host:/\1|p")}")
}
compctl -s '$(mount | \
sed -e "s/^[^ ]* on \\([^ ]*\\) type.*/\\1/"'"$(
if [[ ! $UID = 0 ]]; then
echo ' | egrep "^${(j:|:)$(comp_fsmount)}\$"'
fi)"')' umount
compctl -s '$(comp_fsmount)' + \
-x 'S[/]' -f -- + \
-x 'C[0,*:*]' -K comp_nfsmount -- + \
-s '$(< /etc/hosts)' \
mount
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: completion for (u)mount
1998-01-20 4:33 completion for (u)mount Stefan Monnier
@ 1998-01-20 4:45 ` Timothy J Luoma
0 siblings, 0 replies; 2+ messages in thread
From: Timothy J Luoma @ 1998-01-20 4:45 UTC (permalink / raw)
To: Stefan Monnier; +Cc: zsh-users
Author: Stefan Monnier
<monnier+lists/zsh/users/news/@TEQUILA.SYSTEMSZ.CS.YALE.EDU>
Original-Date: 19 Jan 1998 23:33:29 -0500
Message-ID: <5l3eij69ye.fsf@tequila.systemsz.cs.yale.edu>
> I just hacked up comletion for mount and umount on Linux. I figured some
> completion fanatics might like it.
Cool.
Two questions:
1) how can I remove the "must be root" stuff?
2) how can I remove "/" and filesystems listed as "swapfs" from
being offered for completions?
Completions are always welcomed, as I have no grasp on how they actually work.
TjL
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-01-20 5:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-20 4:33 completion for (u)mount Stefan Monnier
1998-01-20 4:45 ` Timothy J Luoma
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).