From 35f8500373cd3d33d2ef21cf76591c25147afcc5 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Tue, 15 Sep 2009 09:57:48 +0000 Subject: [PATCH] sshfs-mapper: Added bash completion. git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1426 eaee96b3-f302-0410-b096-c6cfd47f7835 --- Makefile | 1 + sshfs-mapper.completion | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 sshfs-mapper.completion diff --git a/Makefile b/Makefile index 06bf95e..44ff6e3 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ install: mkdir -p $(MANDIR)/man1 cp sshfs-mapper $(BINDIR)/ cat sshfs-mapper.1 | gzip > $(MANDIR)/man1/sshfs-mapper.1.gz + install -D -o root -g root -m 644 $(CURDIR)/sshfs-mapper.completion $(DESTDIR)/etc/bash_completion.d/sshfs-mapper # mkdir -p $(CONFDIR) for f in `ls conf`; do \ diff --git a/sshfs-mapper.completion b/sshfs-mapper.completion new file mode 100644 index 0000000..d365127 --- /dev/null +++ b/sshfs-mapper.completion @@ -0,0 +1,23 @@ +#!/bin/sh + +_sshfsmapper_opts() +{ + local cur prev sshfsmapper_opts + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + sshfsmapper_opts='-s -h -i -l -u -a' + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$sshfsmapper_opts" -- $cur ) ) + else + if [[ "$prev" == -s ]]; then + COMPREPLY=( $( sshfs-mapper -l 2> /dev/null ) ) + else + COMPREPLY=( $( compgen -W "$sshfsmapper_opts" -- $cur ) ) + fi + fi +} + +complete -F _sshfsmapper_opts $default sshfs-mapper