[Bash-completion-devel] mount, umount completions

Igor Murzov e-mail at date.by
Sun Nov 20 16:35:28 UTC 2011


On Sun, 20 Nov 2011 12:08:13 +0100
Raphaël Droz <raphael.droz+floss at gmail.com> wrote:

> On Sun, Nov 20, 2011 at 02:08:20AM +0300, Igor Murzov wrote:
> > Hi, list.
> > 
> > There are new linux-specific mount and umount completions in the mount
> > branch. Please review and test. The new completions address Alioth
> > bugs #313166, #313214 and #313437.
> 
> just gave a quick look and it seems awesome !
> 
> some tiny notes:
> 
> * smbclient  presence may be tested like done for showmount (or is
> 2>/dev/null enough ?)

Yes, I think that 2>/dev/null is ok here.

> * for umount I would rather strip device path from the list except if
>   ^/dev/ is in the command line.

This is sane, but printing device paths could be probably useful in some cases.

> (and only print non-system mount point ?)
> * then $(lsblk -o MOUNTPOINT) may be useful

I don't think this is a good idea, we don't do arguments validation. Also lsblk output misses a lot of mount points for me:
----------------------------------
$ lsblk
NAME   MAJ:MIN RM   SIZE RO MOUNTPOINT
sda      8:0    0 111,8G  0 
├─sda1   8:1    0  31,4M  0 /boot
├─sda2   8:2    0   502M  0 [SWAP]
├─sda3   8:3    0  11,7G  0 /
└─sda4   8:4    0  99,6G  0 /home
sr0     11:0    1  1024M  0 
sdb      8:16   0  74,5G  0 
└─sdb1   8:17   0  74,5G  0 
sdc      8:32   1   1,9G  0 
└─sdc1   8:33   1   1,9G  0
$ mount
/dev/sda3 on / type reiserfs (rw,relatime)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /boot type ext2 (rw)
/dev/sda4 on /home type reiserfs (rw)
/dev/sdb1 on /home/lxuser/Documents/torrent type btrfs (rw,subvol=torrent)
/dev/sdb1 on /usr/src type btrfs (rw,subvol=src)
/dev/sdb1 on /var/mirror type btrfs (rw,subvol=slackware-mirror)
/dev/sdb1 on /tmp/tgz type btrfs (rw,subvol=build)
/home/lxuser/repository on /srv/ftp/slack-soft type none (rw,bind)
----------------------------------

> * There should be a way to test if we are completing a device (_filedir)
>   or a mount point (_filedir -d) (at the end of the completion)

This would probably require full reimplementation of mount's arguments parser :) But if someone can do this, that's would be cool.

> * why not dropping some short options from the list (like --fork and
> -F), while still completing the argument for both form.

Ok, that's not a big deal, will do. Though I don't understand why drop short options.

> * is ' sshfs#HOST:RPATH PATH ' syntax in the scope of the device path
>   completion within mount ? (so would be obex#, ... and a bunch of other
>   fuse FS :) )

Hm... I don't personally use such things. May be someone more experienced in that things would like to write some code to add sshfs-like syntax support.
 
> thank you !

You are welcome :)


-- Igor



More information about the Bash-completion-devel mailing list