Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Jun 2012 08:12:10 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: bash completion

On 06/11/2012 02:39 AM, magnum wrote:
> On 2012-06-09 17:08, Frank Dittrich wrote:
> Was that supposed to fix a redirected "<file" too? I tried it now but it
> does not seem to make any difference in either case.

No, sorry, my bad.

The attached patch fixes it.
Also, instead of

$ ./unique [tab][tab]
giving
$ ./unique
OUTPUT-FILE             [-ex_file=FNAME2]       [-inp=fname]            [-v]
[-cut=len]              [-ex_file_only=FNAME2]  [-mem=num]

for the jumbo version, now you get completion for file names and
directories.

And I fixed unintended file name completion for -inp= and other options,
if the (non-jumbo) unique version doesn't support those.

Frank

>From 6bc5053b0fb101366d3355a8b9b111123ae173cf Mon Sep 17 00:00:00 2001
From: Frank Dittrich <frank_dittrich@...mail.com>
Date: Mon, 11 Jun 2012 08:06:06 +0200
Subject: [PATCH] Fix bash completion for unique

---
 run/john.bash_completion |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/run/john.bash_completion b/run/john.bash_completion
index 363a5e3..028cf1a 100644
--- a/run/john.bash_completion
+++ b/run/john.bash_completion
@@ -558,19 +558,22 @@ _unique()
 	first="${COMP_WORDS[0]}"
 	usage=`${first}|grep '^Usage:'|sed 's#^Usage:\? \?[^ ]*unique *##'`
 	case "_${cur}" in
-		_|_${first})
-			if [[ "_${usage}" != "_OUTPUT-FILE" ]] ; then
-				COMPREPLY=( $(compgen -W "${usage}" -- "") )
-			fi
-			return 0
-			;;
+#		_|_${first})
+#			if [[ "_${usage}" != "_OUTPUT-FILE" ]] ; then
+#				COMPREPLY=( $(compgen -W "${usage}" -- "") )
+#				_filedir
+#			fi
+#			return 0
+#			;;
 		_-cut=*|_-mem=*)
 			return 0
 			;;
 		_-inp=*|_-ex_file=*|_-ex_file_only=*)
-			cur=${cur#*=}
-			__expand_tilde_by_ref cur 2>/dev/null
-			_filedir
+			if [[ "_${usage}" != "_OUTPUT-FILE" ]] ; then
+				cur=${cur#*=}
+				__expand_tilde_by_ref cur 2>/dev/null
+				_filedir
+			fi
 			return 0
 			;;
 		_-*)
@@ -589,6 +592,7 @@ _unique()
 			return 0
 			;;
 		_*)
+			_filedir
 			return 0
 			;;
 	esac
-- 
1.7.7.6


Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ