Re: [Cooker] Bash completion patches

2002-01-28 Thread Chmouel Boudjnah

Han [EMAIL PROTECTED] writes:

 Ie very nice but not ready for primetime. I agree with Chmouel on this
 one. Though he is not the man to spend more than one line on this ;)

Pardon ? 

-- 
http://www.chmouel.org/




Re: [Cooker] Bash completion patches

2002-01-28 Thread Guillaume Rousse

Ainsi parlait Han :
 Guillaume Rousse ([EMAIL PROTECTED]) wrote:
  Well, that was only a first quick try :-) I'll try harder.

 I included you're urpmi completion as well. But if you tried with more
 succes ;) please lemme know, and I will bake a -4mdk.
Here is a better one, tough still not able to compete with zsh :-)
I submitted it to bash_completion file maintainer, off course, but until it 
get merged, could you add it as a distinct patch ? Thanks. 

# Mandrake urpmi functions
#
have urpmi 
_urpmi.medias()
{
# return list of available urpmi medias
COMPREPLY=( $( cat /etc/urpmi/urpmi.cfg | awk '/{/ {print $1}' | grep ^$cur 
) )

}
have urpmi 
_urpmi()
{
COMPREPLY=()
local cur prev

cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

case $prev in
--media)
_urpmi.medias
return 0;;
esac

if [[ $cur == -* ]]; then
# return list of available options
COMPREPLY=( $( compgen -W '--help --update --media --auto \
--auto-select --complete --force --wget --curl --X \
--best-output -a -p -q -v' | grep ^$cur ) )
else
# return list of available packages
COMPREPLY=( $( gzip -dc /var/lib/urpmi/synthesis.hdlist.* \
| awk 'BEGIN {FS=@} /info/ {print $1}' | grep ^$cur ) )
fi

}
[ $have ]  complete -F _urpmi urpmi
have urpmi.update 
_urpmi.update()
{
COMPREPLY=()
local cur

cur=${COMP_WORDS[COMP_CWORD]}

if [[ $cur == -* ]]; then
# return list of available options
COMPREPLY=( $( compgen -W '-a -c -f --curl --wget' | grep ^$cur ) )
else
# return list of available medias
_urpmi.medias
fi

}
[ $have ]  complete -F _urpmi.update urpmi.update
have urpmi.addmedia 
_urpmi.addmedia()
{
COMPREPLY=()
local cur i args

cur=${COMP_WORDS[COMP_CWORD]}

if [[ $cur == -* ]]; then
# return list of available options
COMPREPLY=( $( compgen -W '-c -h -f --wget --curl --update --distrib' 
| 
grep ^$cur ) )
else
# count number of mandatory args given sofar
args=$COMP_CWORD
for (( i=1; i  COMP_CWORD; i++ )); do
if [[ ${COMP_WORDS[i]} == -* ]]; then
args=$(($args-1))
fi
done
case $args in
1)
# return list of available medias
_urpmi.medias
;;
2)
# return list of available protocols
COMPREPLY=( $( compgen -W 'file:// http:// ftp:// 
removable://' | grep 
^$cur ) )
;;
3)
# return word with
COMPREPLY=( $( compgen -W 'with' ) )
;;
esac
fi

}
[ $have ]  complete -F _urpmi.addmedia urpmi.addmedia
have urpmi.removemedia 
_urpmi.removemedia()
{
COMPREPLY=()
local cur

cur=${COMP_WORDS[COMP_CWORD]}

if [[ $cur == -* ]]; then
# if word begins with a dash, return list of available options
COMPREPLY=( $( compgen -W '-a -c' | grep ^$cur ) )
else
# elsewhere, return list of available medias
_urpmi.medias
fi

}
[ $have ]  complete -F _urpmi.removemedia urpmi.removemedia

-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-28 Thread Han

Chmouel Boudjnah ([EMAIL PROTECTED]) wrote:
 Han [EMAIL PROTECTED] writes:
 
  Ie very nice but not ready for primetime. I agree with Chmouel on
  this one. Though he is not the man to spend more than one line on
  this ;)
 
 Pardon ? 

Yes I forgive you.



Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




Re: [Cooker] Bash completion patches

2002-01-28 Thread Han

Han ([EMAIL PROTECTED]) wrote:
 Guillaume Rousse ([EMAIL PROTECTED]) wrote:
  Ainsi parlait Han :
   Guillaume Rousse ([EMAIL PROTECTED]) wrote:
Well, that was only a first quick try :-) I'll try harder.
  
   I included you're urpmi completion as well. But if you tried with more
   succes ;) please lemme know, and I will bake a -4mdk.
  Here is a better one, tough still not able to compete with zsh :-)
  I submitted it to bash_completion file maintainer, off course, but until it 
  get merged, could you add it as a distinct patch ? Thanks. 
 
 Not like a patch, I added theses lines to /etc/bash_completion (as a
 patch) :)
 
 # Mandrake urpmi completion file.
 [ -f /etc/bash_completion_for_urpmi ]  . /etc/bash_completion_for_urpmi

Even a bit different. Anyway:

http://www.xs4all.nl/~hanb/software/bash-2.05a-4mdk.src.rpm


Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




Re: [Cooker] Bash completion patches

2002-01-28 Thread Bart Schaefer

On Jan 27, 11:31am, Borsenkow Andrej wrote:
} Subject: Re: [Cooker] Bash completion patches
}
} On ÷ÓË, 2002-01-27 at 01:18, Liam Quin wrote:
}  Does anyone have completion that uses colour (like ls) and/or
}  bold, to indicate the prefix you have already typed, in matches?

Zsh emits color codes only in completion listings (i.e., when more than
one match is displayed simultaneously), not when there is only one match
inserted on the line and not when doing menu completion (where matches
are cycled on the command line, as opposed to menu selection where
they're shown in columns).

Even in listings/selection, there's no color change sequence emitted
between the prefix and any suffixes; color codes are printed only before
and after each entire match.

-- 
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts  http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   




Re: [Cooker] Bash completion patches

2002-01-27 Thread Borsenkow Andrej

On ÷ÓË, 2002-01-27 at 01:18, Liam Quin wrote:
 Does anyone have completion that uses colour (like ls) and/or
 bold, to indicate the prefix you have already typed, in matches?
 
 I had a go at doing that with zsh a while ago, interactions between the
 output fo the scripts and the fomatting into columns made it hard.
 

Zsh does use (can be configured to) colors in completion listing. I am
not sure about specific color for prefix, because as it looks like most
people switched to menu completion (even hardcore commandliners) that
allows selection of (several) matches with normal cursor keys in full
screen menu. Because you get list of matches anyway it is much faster.

In any case I Cc to Zsh list in case I miss something.

-andrej




Re: [Cooker] Bash completion patches

2002-01-26 Thread Borsenkow Andrej

On ðÔÎ, 2002-01-25 at 20:31, Guillaume Rousse wrote:
 Ainsi parlait Guillaume Rousse :
  Ainsi parlait Han :
   Guillaume Rousse ([EMAIL PROTECTED]) wrote:
Could the patches proposed here about completion be included into
official mandrake bash package, or not until they are accepted by
bash developpers ?  http://www.caliban.org/bash/index.shtml
  
   Check the rpm package in my url ;)
 
  Thanks !
 
 And here is the urpmi completion for bash :-)
 # Mandrake urpmi
 #
 have urpmi 
 _urpmi()
 {
   COMPREPLY=()
   local gcmd
 
   # if we have a partial word to complete, restrict completions to
   # matches of that word
   [ -n $2 ]  gcmd='grep ^$2' || gcmd=cat
 
   COMPREPLY=( $( gzip -dc /var/lib/urpmi/synthesis.hdlist.* |\
   awk 'BEGIN {FS=@} /info/ {print $1}' | sort -u | eval $gcmd ) )
 
 }
 [ $have ]  complete -F _urpmi urpmi
 

And you call *that* completion?! :-) Here is what I call completion:

{pts/3}% urpmi -aTAB
{pts/3}% urpmi --allow-medium-change
Completing option
--allow-medium-change -- allow change of removable media
--auto-- do not ask any questions
--auto-select -- select the packages to update

{pts/3}% u.uTAB
{pts/3}% urpmi.update TAB
{pts/3}% urpmi.update Contrib\ CD\ \(disk2\)
Completing available media
Contrib\ CD\ \(disk2\)Installation\ CD\ \(disk1\)

{pts/3}% urpmi g-c-cTAB
{pts/3}% urpmi gnome-control-center-1.5.11-4mdk
Completing urpmi RPMs to install
gnome-control-center-1.5.11-4mdk   
gnome-control-center-plus-1.5.11-3mdk


And in all cases you can choose the match using cursor screen in full
screen menu; and can select several matches if you like (of course you
can always turn it off).

That is what I call completion :-)


-andrej




Re: [Cooker] Bash completion patches

2002-01-26 Thread Roger

On Sat, 2002-01-26 at 05:50, Borsenkow Andrej wrote:

 And you call *that* completion?! :-) Here is what I call completion:
 
 {pts/3}% urpmi -aTAB
 {pts/3}% urpmi --allow-medium-change
 Completing option
 --allow-medium-change -- allow change of removable media
 --auto-- do not ask any questions
 --auto-select -- select the packages to update
 
 {pts/3}% u.uTAB
 {pts/3}% urpmi.update TAB
 {pts/3}% urpmi.update Contrib\ CD\ \(disk2\)
 Completing available media
 Contrib\ CD\ \(disk2\)Installation\ CD\ \(disk1\)
 
 {pts/3}% urpmi g-c-cTAB
 {pts/3}% urpmi gnome-control-center-1.5.11-4mdk
 Completing urpmi RPMs to install
 gnome-control-center-1.5.11-4mdk   
 gnome-control-center-plus-1.5.11-3mdk
 
 
 And in all cases you can choose the match using cursor screen in full
 screen menu; and can select several matches if you like (of course you
 can always turn it off).
 
 That is what I call completion :-)
 
 
 -andrej

Now, dat completion!

 







Re: [Cooker] Bash completion patches

2002-01-26 Thread Yves Duret

Han [EMAIL PROTECTED] writes:

 I have been using the completion patches for a while now and sometimes
 it works nice but lots of times it makes mistakes. For example:
 
 cd-ing into a dir with spaces.
 rpm -ba --clean f[tab] does not find foo.spec
 man d[tab] shows all manpages with a d but also some nonsence.
 
 Ie very nice but not ready for primetime. I agree with Chmouel on this
 one. Though he is not the man to spend more than one line on this ;)

use zsh.
-- 
Yves Duret
[EMAIL PROTECTED]
piouk toujours et meme apres !





Re: [Cooker] Bash completion patches

2002-01-26 Thread Han

Yves Duret ([EMAIL PROTECTED]) wrote:
 Han [EMAIL PROTECTED] writes:
 
  I have been using the completion patches for a while now and
  sometimes it works nice but lots of times it makes mistakes. For
  example:
  
  cd-ing into a dir with spaces.  rpm -ba --clean f[tab] does not find
  foo.spec man d[tab] shows all manpages with a d but also some
  nonsence.
  
  Ie very nice but not ready for primetime. I agree with Chmouel on
  this one. Though he is not the man to spend more than one line on
  this ;)
 
 use zsh.

That is an option. :)


Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




Re: [Cooker] Bash completion patches

2002-01-26 Thread Guillaume Rousse

Ainsi parlait Borsenkow Andrej :
 On ðÔÎ, 2002-01-25 at 20:31, Guillaume Rousse wrote:
  Ainsi parlait Guillaume Rousse :
   Ainsi parlait Han :
Guillaume Rousse ([EMAIL PROTECTED]) wrote:
 Could the patches proposed here about completion be included into
 official mandrake bash package, or not until they are accepted by
 bash developpers ?  http://www.caliban.org/bash/index.shtml
   
Check the rpm package in my url ;)
  
   Thanks !
 
  And here is the urpmi completion for bash :-)
  # Mandrake urpmi
  #
  have urpmi 
  _urpmi()
  {
  COMPREPLY=()
  local gcmd
 
  # if we have a partial word to complete, restrict completions to
  # matches of that word
  [ -n $2 ]  gcmd='grep ^$2' || gcmd=cat
 
  COMPREPLY=( $( gzip -dc /var/lib/urpmi/synthesis.hdlist.* |\
  awk 'BEGIN {FS=@} /info/ {print $1}' | sort -u | eval $gcmd ) )
 
  }
  [ $have ]  complete -F _urpmi urpmi

 And you call *that* completion?! :-) Here is what I call completion:
Well, that was only a first quick try :-) I'll try harder.
-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-26 Thread Goetz Waschk

Am Samstag, 26. Januar 2002, 03:16:19 Uhr MET, schrieb Han:
 I have been using the completion patches for a while now and sometimes
 it works nice but lots of times it makes mistakes. For example:
 
 cd-ing into a dir with spaces.
 rpm -ba --clean f[tab] does not find foo.spec
 man d[tab] shows all manpages with a d but also some nonsence.
 
 Ie very nice but not ready for primetime. I agree with Chmouel on this
 one. Though he is not the man to spend more than one line on this ;)
Hi,
what bash version are you using? The completion package uses some features of
bash 2.05a. The dir name with spaces-problem will disappear if you upgrade
your bash package.

CU
-- 
   Götz Waschk  student of computer science   university Rostock
 http://www.informatik.uni-rostock.de/~waschk/waschk.asc for PGP key
 -- Logout Fascism! --




Re: [Cooker] Bash completion patches

2002-01-26 Thread Guillaume Rousse

Ainsi parlait Goetz Waschk :
 Am Samstag, 26. Januar 2002, 03:16:19 Uhr MET, schrieb Han:
  I have been using the completion patches for a while now and sometimes
  it works nice but lots of times it makes mistakes. For example:
 
  cd-ing into a dir with spaces.
  rpm -ba --clean f[tab] does not find foo.spec
  man d[tab] shows all manpages with a d but also some nonsence.
 
  Ie very nice but not ready for primetime. I agree with Chmouel on this
  one. Though he is not the man to spend more than one line on this ;)

 Hi,
 what bash version are you using? The completion package uses some features
 of bash 2.05a. The dir name with spaces-problem will disappear if you
 upgrade your bash package.
The bash version is ok (2.05a), but the bash_completion file provided is 
outdated (1.32, while current is 1.70)
-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-26 Thread Han

Guillaume Rousse ([EMAIL PROTECTED]) wrote:
 Ainsi parlait Goetz Waschk :
  Am Samstag, 26. Januar 2002, 03:16:19 Uhr MET, schrieb Han:
   I have been using the completion patches for a while now and
   sometimes it works nice but lots of times it makes mistakes. For
   example:
  
   cd-ing into a dir with spaces.  rpm -ba --clean f[tab] does not
   find foo.spec man d[tab] shows all manpages with a d but also some
   nonsence.
  
   Ie very nice but not ready for primetime. I agree with Chmouel on
   this one. Though he is not the man to spend more than one line on
   this ;)
 
  what bash version are you using? The completion package uses some
  features of bash 2.05a. The dir name with spaces-problem will
  disappear if you upgrade your bash package.

 The bash version is ok (2.05a), but the bash_completion file provided
 is outdated (1.32, while current is 1.70)

Probably. I am so busy updating all the time I often forget to update
things ;) No really. I thought nobody was interested in bash completion.

But eh Guillaume Where can I download that latest rpm?  Would save
me a lot of time. :)


Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




Re: [Cooker] Bash completion patches

2002-01-26 Thread Liam Quin

Does anyone have completion that uses colour (like ls) and/or
bold, to indicate the prefix you have already typed, in matches?

I had a go at doing that with zsh a while ago, interactions between the
output fo the scripts and the fomatting into columns made it hard.

Liam

-- 
Liam Quin - XML Core staff contact, W3C, http://www.w3.org/People/Quin/
Ankh: irc.sorcery.net www.valinor.sorcery.net irc.gnome.org www.advogato.org
Author, Open Source XML Database Toolkit, Wiley August 2000
Co-author: The XML Specification Guide, Wiley 1999; Mastering XML, Sybex 2001




Re: [Cooker] Bash completion patches

2002-01-26 Thread Han

Guillaume Rousse ([EMAIL PROTECTED]) wrote:

 Well, that was only a first quick try :-) I'll try harder.

I included you're urpmi completion as well. But if you tried with more
succes ;) please lemme know, and I will bake a -4mdk.

http://www.xs4all.nl/~hanb/software/bash-2.05a-3mdk.src.rpm


Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




[Cooker] Bash completion patches

2002-01-25 Thread Guillaume Rousse

Could the patches proposed here about completion be included into official 
mandrake bash package, or not until they are accepted by bash developpers ?
http://www.caliban.org/bash/index.shtml
-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-25 Thread Han

Guillaume Rousse ([EMAIL PROTECTED]) wrote:
 Could the patches proposed here about completion be included into
 official mandrake bash package, or not until they are accepted by
 bash developpers ?  http://www.caliban.org/bash/index.shtml

Check the rpm package in my url ;)

Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software




Re: [Cooker] Bash completion patches

2002-01-25 Thread Guillaume Rousse

Ainsi parlait Han :
 Guillaume Rousse ([EMAIL PROTECTED]) wrote:
  Could the patches proposed here about completion be included into
  official mandrake bash package, or not until they are accepted by
  bash developpers ?  http://www.caliban.org/bash/index.shtml

 Check the rpm package in my url ;)
Thanks !
I just had to apply this patch to fix a conflict with sh-utils

--- bash.spec   Wed Dec 19 13:28:40 2001
+++ bash.spec.new   Fri Jan 25 16:15:47 2002
@@ -3,7 +3,7 @@
 Summary: The GNU Bourne Again shell (bash).
 Name: bash
 Version: 2.05a
-Release: 2mdk
+Release: 3mdk
 Group: Shells
 BuildRequires: readline-devel libtermcap-devel autoconf2.5 = 2.52d
 License: GPL
@@ -160,7 +160,7 @@
 s/$/.1.bz2/
 '  ../man.pages

-perl -p -i -e 's\.*/(export|echo|pwd|test|kill).1.bz2\\' ../man.pages
+perl -p -i -e 's\.*/(export|echo|pwd|test|kill|printf).1.bz2\\' ../man.pages

 mkdir -p %buildroot/etc/skel
 install -c -m644 %{SOURCE2} %buildroot/etc/skel/.bashrc
@@ -202,7 +202,11 @@
 %doc doc/*.ps doc/*.0 doc/*.html doc/article.txt

 %changelog
-* Wed Dec 19 2001 Han Boetes [EMAIL PROTECTED] 2.05a-1mdk
+* Fri Jan 25 2002 Guillaume Rousse [EMAIL PROTECTED] 2.05a-3mdk
+- removed printf man page conflicting with sh-utils
+- corrected changelog
+
+* Wed Dec 19 2001 Han Boetes [EMAIL PROTECTED] 2.05a-2mdk
 - Removed obsolete patches

 * Tue Dec 18 2001 Han Boetes [EMAIL PROTECTED] 2.05a-1mdk

-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-25 Thread Guillaume Rousse

Ainsi parlait Guillaume Rousse :
 Ainsi parlait Han :
  Guillaume Rousse ([EMAIL PROTECTED]) wrote:
   Could the patches proposed here about completion be included into
   official mandrake bash package, or not until they are accepted by
   bash developpers ?  http://www.caliban.org/bash/index.shtml
 
  Check the rpm package in my url ;)

 Thanks !

And here is the urpmi completion for bash :-)
# Mandrake urpmi
#
have urpmi 
_urpmi()
{
COMPREPLY=()
local gcmd

# if we have a partial word to complete, restrict completions to
# matches of that word
[ -n $2 ]  gcmd='grep ^$2' || gcmd=cat

COMPREPLY=( $( gzip -dc /var/lib/urpmi/synthesis.hdlist.* |\
awk 'BEGIN {FS=@} /info/ {print $1}' | sort -u | eval $gcmd ) )

}
[ $have ]  complete -F _urpmi urpmi

-- 
Guillaume Rousse [EMAIL PROTECTED]
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html




Re: [Cooker] Bash completion patches

2002-01-25 Thread Han

Guillaume Rousse ([EMAIL PROTECTED]) wrote:
 Ainsi parlait Guillaume Rousse :
  Ainsi parlait Han :
   Guillaume Rousse ([EMAIL PROTECTED]) wrote:
Could the patches proposed here about completion be included
into official mandrake bash package, or not until they are
accepted by bash developpers ?
http://www.caliban.org/bash/index.shtml
  
   Check the rpm package in my url ;)
 
  Thanks !
 
 And here is the urpmi completion for bash :-)
 # Mandrake urpmi
 #
 have urpmi 
 _urpmi()
 {
   COMPREPLY=()
   local gcmd
 
   # if we have a partial word to complete, restrict completions to
   # matches of that word
   [ -n $2 ]  gcmd='grep ^$2' || gcmd=cat
 
   COMPREPLY=( $( gzip -dc /var/lib/urpmi/synthesis.hdlist.* |\
   awk 'BEGIN {FS=@} /info/ {print $1}' | sort -u | eval $gcmd ) )
 
 }
 [ $have ]  complete -F _urpmi urpmi

I have been using the completion patches for a while now and sometimes
it works nice but lots of times it makes mistakes. For example:

cd-ing into a dir with spaces.
rpm -ba --clean f[tab] does not find foo.spec
man d[tab] shows all manpages with a d but also some nonsence.

Ie very nice but not ready for primetime. I agree with Chmouel on this
one. Though he is not the man to spend more than one line on this ;)


Groetjes, Han.
-- 
http://www.xs4all.nl/~hanb/software