[Bash-completion-devel] bash-completion: mkdir only completes directories

David Paleino d.paleino at gmail.com
Sun May 11 13:38:03 UTC 2008


tags 376433 = pending
thanks

On Sun, 11 May 2008 14:19:51 +0100 (BST), Reuben Thomas wrote:

> On Sun, 11 May 2008, David Paleino wrote:
> 
> > tags 376433 wontfix moreinfo
> > thanks
> >
> > Hi Reuben, why should mkdir complete on filenames? Mkdir is a 
> > directory-only command -- am I wrong?
> 
> I often want to create a directory with a similar name to an existing file.

Thanks for the quick reply.
I understood your reasoning, and I've just committed the change which fixes
this in our Bzr repository. If you don't want to wait long for a new upload,
here's a quick patch:

--- bash_completion
+++ bash_completion.new
@@ -4154,7 +4154,7 @@
 		COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
 				-e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
 			       command grep "^$cur" | sort -u ) )
-	elif [[ "$1" == @(mk|rm)dir ]]; then
+	elif [[ "$1" == rmdir ]]; then
 		_filedir -d
 	else
 		_filedir


Please be warned that mkdir will fail if trying to create a directory called as
an existing filename.

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20080511/f78d75dc/attachment.pgp 


More information about the Bash-completion-devel mailing list