[PATCH 3/8] 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 | 10 +++++++++-
 bash-completion/isosize     | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/bash-completion/fsck.cramfs b/bash-completion/fsck.cramfs
index 0d27b1c..afae495 100644
--- a/bash-completion/fsck.cramfs
+++ b/bash-completion/fsck.cramfs
@@ -15,7 +15,15 @@ _fsck.cramfs_module()
 			return 0
 			;;
 	esac
-	COMPREPLY=( $(compgen -W "$(fsck.cramfs --print-long-opts)" -S ' ' -- $cur) )
+	case $cur in
+		-*)
+			COMPREPLY=( $(compgen -W "$(fsck.cramfs --print-long-opts)" -- $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 57f99c6..c38ff97 100644
--- a/bash-completion/isosize
+++ b/bash-completion/isosize
@@ -13,7 +13,15 @@ _isosize_module()
 			return 0
 			;;
 	esac
-	COMPREPLY=( $(compgen -W "$(isosize --print-long-opts)" -- $cur) )
+	case $cur in
+		-*)
+			COMPREPLY=( $(compgen -W "$(isosize --print-long-opts)" -- $cur) )
+			return 0
+			;;
+	esac
+	local IFS=$'\n'
+	compopt -o filenames
+	COMPREPLY=( $(compgen -f -- $cur) )
 	return 0
 }
 complete -F _isosize_module isosize
-- 
2.6.4

--
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