help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exclude builtins from command completion


From: kaycee gb
Subject: Re: Exclude builtins from command completion
Date: Fri, 17 Jan 2020 17:18:35 +0000

Le Mon, 13 Jan 2020 16:46:11 +0000,
kaycee gb <address@hidden> a écrit :

> Le Mon, 13 Jan 2020 08:39:10 -0500,
> Greg Wooledge <address@hidden> a écrit :
> 
> > On Fri, Jan 10, 2020 at 11:31:02PM +0000, kaycee gb wrote:
> > > I know that it starts to be old. But It's just I can't leave my slack 14.1
> > > like this :/
> > 
> > > For the slack pc, I tried to bump bash from slack 14.2 but still too
> > > old, there is no -I :/ 
> > 
> > Leave your operating system's version of bash alone.  Touching that is
> > likely to break something that won't be easily fixed.
> 
> Like said before in another reply, bumping up bash version (from OS's next
> version) did not help to have the working condition I wanted. In
> addition, it showed a problem with a variable, MANWIDTH or COLWIDTH, something
> like that. Potentially others. 
> 
> I have rollbacked bash to the version present in version of the operating
> system's package repository.
> 
> But changes like this help me to learn, the hard way. ;)
> > 
> > Get the source code and compile bash yourself, and install it in
> > /usr/local or in /opt/bash5 or something.  Now you'll have multiple
> > versions of bash installed, and you can use whichever one you want,
> > and not have to worry about breaking operating system scripts.
> > 
> Interesting possibility. I have not thought about that. I keep that in my
> head. Thanks :)
> 
> kaycee,
> 
> 

Finally I done it. Installed bash5 in parallel with the one from the system. 

It's a lot better. After some try and retry I added something simple. 

_commandcomp()
{
  local w
  w="$2"
  local CMDS=$( _get_custom_commands )

  COMPREPLY=( $(compgen -W "$CMDS" "$w") )
}
complete -I -F _commandcomp

Now starting to type a command at an emtpy prompt and pressing tab, I have
completion proposals only from my custom commands. That's good. 

When I was trying to achieve that, by accident I entered a colon ":" at an empty
prompt. I expected that it will do nothing but in fact that lists all files in
the current directory. 

$ :<TAB><TAB>
bash-5.0-patches/       bash.SlackBuild~        slack-desc
bash-5.0.tar.lz         bash_manpages.patch.gz  
bash.SlackBuild         doinst.sh.gz

Is this an expected behaviour ? It does not seem to reach the -I part. 
I tried other characters but for the moment just this one is doing that. 

kaycee,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]