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

Re: 'loop' vs 'loop=device' in _mount



On Thu, 27 Aug 2009, Peter Stephenson wrote:

> On Wed, 26 Aug 2009 18:03:32 -0400 (EDT)
> "Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:
> > When using completion for mount options, I often run into the annoyance 
> > that the 'loop' option prompts for the loopback devide to use.  Really, 
> > though, one needn't specify any device in particular...  Says the man-page 
> > for 'mount':
> > 
> > '''
> > If no explicit loop device is mentioned (but just an option `-o loop' is 
> > given), then mount will try to find some unused loop device and use that.
> > '''
> > 
> > I'll likely just patch my own completion script to change:
> > 
> > Completion/Unix/Command/_mount, line 325:
> > -      'loop[use loopback device]:loopback device:_files'
> > +      'loop[use loopback device]'
> > 
> > since I couldn't tell how to incorporate an '-o' option that accepts an 
> > optional argument.
> 
> It should be just a question of doubling the first colon, as follows
> (see the documentation for _values).  However, I couldn't get the suffix
> (i.e. the "=") added to be removed when I typed ",", i.e. tried to add a
> new list option instead of an argument... until it finally occurred to
> me after an astonishing amount of looking in completely the wrong place
> that I hadn't told it when to remove it (patch to _values---so non-final
> optional arguments to values were always a bit inconvenient).

Oh, good, I'm not crazy...  I tried doubling the colon (seeing it used 
with '(nocheck)check[...]::checking level:...'), and experienced that 
problem.



> The following should do more or less what you want; the behaviour is
> like that after "/" in file names, but the "," will cause the
> auto-remove behaviour of the "=", too.

Indeed.  This does exactly what I want.

Thanks,
Ben



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