[PATCH 06/10] bash-completion: fsck.cramfs, isosize: find files an argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Earlier completion suggested only options for the command, this changes
options to be proposed when first character of an argument is dash.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 bash-completion/fsck.cramfs | 11 +++++++++--
 bash-completion/isosize     | 11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/bash-completion/fsck.cramfs b/bash-completion/fsck.cramfs
index acf6564..b3276b9 100644
--- a/bash-completion/fsck.cramfs
+++ b/bash-completion/fsck.cramfs
@@ -15,8 +15,15 @@ _fsck.cramfs_module()
 			return 0
 			;;
 	esac
-	OPTS='--verbose --destination --help --version file'
-	COMPREPLY=( $(compgen -W "${OPTS[*]}" -S ' ' -- $cur) )
+	case $cur in
+		-*)
+			COMPREPLY=( $(compgen -W "--verbose --blocksize --extract --help --version" -- $cur) )
+			return 0
+			;;
+	esac
+	local IFS=$'\n'
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
 	return 0
 }
 complete -F _fsck.cramfs_module fsck.cramfs
diff --git a/bash-completion/isosize b/bash-completion/isosize
index 13d4d29..fec2f8b 100644
--- a/bash-completion/isosize
+++ b/bash-completion/isosize
@@ -13,8 +13,15 @@ _isosize_module()
 			return 0
 			;;
 	esac
-	OPTS='--divisor --sectors --help --version'
-	COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+	case $cur in
+		-*)
+			COMPREPLY=( $(compgen -W "--divisor --sectors --help --version" -- $cur) )
+			return 0
+			;;
+	esac
+	local IFS=$'\n'
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
 	return 0
 }
 complete -F _isosize_module isosize
-- 
2.7.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux