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

On 05/16/2012 10:54 PM, magnum wrote:
> On 05/16/2012 12:48 PM, Frank Dittrich wrote:
>> I'll wait until this version appears in your git repo, then I'll post to
>> john-users and ask the users for their opinion.
> 
> Committed now

Thanks. Before posting to john-users, I fixed a few bugs, diff attached.
(File name expansion for "--wordlist=" didn't work, and I also forgot to
implement the default completion logic for --restore|--status)

So far, http://openwall.com/lists/john-users/2012/05/21/1 didn't get any
replies.
Before releasing the next jumbo, is a separate README file for bash
completion required?

Frank

--- john.bash_completion.orig	2012-05-20 09:54:31.000000000 +0000
+++ john.bash_completion	2012-05-21 14:51:02.776493936 +0000
@@ -91,7 +91,7 @@
 ## have grep && have sed && 
 _john()
 {
-	local first cur options valopts compreplya compreplyb encodings formats subformats list hidden dir cmd i ver ver1 ver2 ver3
+	local first cur options valopts compreplya compreplyb encodings formats subformats list hidden dir cmd i ver ver1 ver2 ver3 prev
 	COMPREPLY=()
 	_get_comp_words_by_ref -n = cur
 
@@ -152,6 +152,14 @@ _john()
 			if [[ "_${__john_completion}" == "_2" ]] ; then
 				COMPREPLY=( $(compgen -W "${cur}=" -- ${cur}) )
 				compopt -o nospace
+			else
+				prev="${cur}"
+				cur=""
+				_filedir "rec"
+				for (( i=0; i < ${#COMPREPLY[@... i++)); do
+					COMPREPLY[$i]="${prev}=${COMPREPLY[$i]%*.rec}"
+				done
+				COMPREPLY[${#COMPREPLY[@...="${prev}"
 			fi
 			return 0
 			;;
@@ -172,10 +180,9 @@ _john()
 			return 0
 			;;
 		--wordlist=*)
-			#cur=${cur#*=}
-			#_filedir expansion of --wordlist=~/te doesn't work
-			# _filedir_xspec "_xspecs: bad array subscript" written to stderr
-			_filedir_xspec 2> /dev/null
+			cur=${cur#*=}
+			 __expand_tilde_by_ref cur 2>/dev/null
+			_filedir
 			return 0
 			;;
  		--rules|--single)

Powered by blists - more mailing lists

Your e-mail address:

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