[Bash-completion-devel] [bash-completion-Bugs][311408] DBTS 501842: complete for 'cc' also on !GNU, !Linux and !Cygwin

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Fri Dec 23 22:59:49 UTC 2011


Bugs item #311408, was changed at 2009-01-30 10:18 by Freddy Vulto
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311408&group_id=100114

Status: Closed
Priority: 2
Submitted By: David Paleino (hanska-guest)
Assigned to: Ville Skyttä  (scop-guest)
Summary: DBTS 501842: complete for 'cc' also on !GNU, !Linux and !Cygwin 
Distribution: None
Originally reported in: Debian BTS
Milestone: None
Status: Fix Committed
Original bug number: 501842


Initial Comment:
* Completion for the various GCC compilers occurs on any system, but
  only with a uname of GNU, Linux, or Cygwin will bash-completion add
  those same completions to the "cc" command.  bash-completion
  probably assumes that other systems will not have gcc installed as
  "cc".


----------------------------------------------------------------------

>Comment By: Freddy Vulto (fvu-guest)
Date: 2011-12-23 23:59

Message:
If it would've slowed down load time, one could delay the action to the first time the completion is invoced.  E.g. as is done for vncviewer:

    _vncviewer_bootstrap()
    {
        local fname
        case $(_realcommand vncviewer) in
            *xvnc4viewer)      fname=_xvnc4viewer    ;;  
            *tightvncviewer)   fname=_tightvncviewer ;;
            *)                 fname=_known_hosts    ;;  
        esac

        # Install real completion for subsequent completions
        complete -F $fname vncviewer
        $fname  # Generate completions once for now
        unset -f _vncviewer_bootstrap
    } &&
    complete -F _vncviewer_bootstrap vncviewer

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2011-12-19 23:38

Message:
Done in commit ae34153, also for c++.

----------------------------------------------------------------------

Comment By: Igor Murzov (garik-guest)
Date: 2011-12-19 20:32

Message:
> We could do something like: cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc

This is probably better, as this way we can ensure, that cc really points to the gcc. This is not likely to slow load time down.

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2011-04-25 15:09

Message:
The test whether to complete cc is now userland = GNU or uname = cygwin.  Do we want to add something to the list?

We could do something like:

cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc

...but dunno if something like that is appropriate considering the test happens at completion load time (and would currently add some to the slowness of it).

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311408&group_id=100114



More information about the Bash-completion-devel mailing list