[Bash-completion-devel] Directory name completion fails if name contains spaces and is quoted
Morita Sho
morita-pub-en-debian at inz.sakura.ne.jp
Sun May 11 20:36:13 UTC 2008
Hi,
On Sun, 11 May 2008 17:26:34 +0200, David Paleino wrote:
> Morita, you can have a look at what _get_cword looks like at our Bzr
> repository [0]. That is the result of a merge of Ubuntu's, Debian's and
> upstream's code. I'm currently looking for a way to merge your code with this,
> but it won't be that simple ;) -- jokes aside, I believe we *really* need to
> clean up that code a bit.
> [0] $ bzr co http://bzr.debian.org/bash-completion/current/ bash-completion
OK, I'll have a look at that.
Because I have never used bzr, I installed bzr.
But when I try to checkout, I had an error:
$ bzr co http://bzr.debian.org/bash-completion/current/ bash-completion
bzr: ERROR: Transport error: Server refuses to fullfil the request
A log file ~/.bzr.log told me
failed to import pycurl: No module named pycurl
so I installed python-pycurl, and try checkout again, it works.
I'm not sure what's wrong, but I can start to look latest code.
First of all, this command
$ source bash_completion
shows some error. so I need to fix it. [1]
Plus, once bash_completion is sourced, they set variables BASH_COMPLETION and
BASH_COMPLETION_DIR,
and when bash_completion is sourced next time, they stop to reading the code.
(Is this intended behavior?)
It is not useful for developing, I need to uncomment following line:
readonly BASH_COMPLETION BASH_COMPLETION_DIR
On Sun, 11 May 2008 18:00:55 +0200, David Paleino wrote:
> I've currently patched _get_cword()... please try to enclose into quotes the
> last line of the function:
>
> echo "$cur"
>
> instead of
>
> echo $cur
>
>
> This works for me (and, yes, it also considers " and ' as quoting characters
> now).
>
> Tagging the bug as "pending", waiting for a reply.
Hmmmm... I can see $cur has been enclosed into quotes in latest code, but
$ source bash_completion
$ mkdir "FOO BAR"
$ cd "FOO B[TAB]
is still not works for me...
IMHO, the difference between "$cur" and $cur is whether word splitting is occurs
or not,
and word splitting does not considers quoting.
I think, although changing $cur to "$cur" resolves some space-related problems,
it will not resolves quote-related problems.
Thanks,
[1]
--- bash_completion 2008-05-11 16:35:16 +0000
+++ bash_completion 2008-05-11 18:06:47 +0000
@@ -2560,7 +2560,7 @@
fi
# append any available aliases from config files
if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
- local host_aliases=$( sed -ne
's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']*\([^*?]*\)$/\2/p'
${config[@]} )" )
+ local host_aliases=$( sed -ne
's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']*\([^*?]*\)$/\2/p'
${config[@]} )
hosts=$( compgen -W "$host_aliases" -- $ocur )
COMPREPLY=( ${COMPREPLY[@]} $hosts )
fi
@@ -4272,7 +4272,6 @@
half-configured|config-files" | \
grep "Package: $1" | cut -d\ -f2
}
-}
# Debian dpkg(8) completion
#
--
Morita Sho <morita-pub-en-debian at inz.sakura.ne.jp>
More information about the Bash-completion-devel
mailing list