Bug#282799: bash: Completion of fd redirect after find command limited to directories (forwarded from Lionel Elie Mamane) (forwarded from Ian Macdonald)

2006-02-24 Thread Ian Macdonald
On Sat 10 Sep 2005 at 17:00:05 -0400, you wrote:

 
  find  foo
 ask for autocompletion there, only directories are taken into
 account.
  ls  foo
 or
  cat  foo
 autocomplete to all filenames (directories and non-directories), as it
 should.
  
  
  This is a limitation of the completion mechanism. There's no easy way to
  detect redirection at arbitrary positions on the command line and act
  accordingly. To do so would require each command completion function to
  handle redirection internally. A more generic solution is required at
  the bash level itself.
 
 And what do you suggest that generic solution should be?  Don't call
 the programmable completion code at all if the previous token appears
 to be a redirection?

It's a very difficult question with no ideal solution.

Not incrementing $COMP_CWORD after a redirection token is one option,
but that would lead to other problems. Thinking about it, though, it
might still be preferable to the current status quo.

Otherwise, context-sensitive completion functions will always have to do
something like this:

if [[ ${COMP_WORDS[COMP_CWORD-1]} = *[]* ]]; then

Something that is required by virtually any non-trivial completion
function seems like something that should be tackled a level higher.

Not a great solution, but the best I can come up with at the moment.

Sorry for the absurdly long delay in replying. I've been completely out
of touch for six months as I relocated back to Europe with a new baby,
bought a house, etc.

Cheers,

Ian
-- 
Ian Macdonald   | * JHM wonders what Joey did to earn I'd
[EMAIL PROTECTED] | just like to say, for the record,   that
http://www.caliban.org/ | Joey rules.  -- Seen on #Debian 
| 
| 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#282799: bash: Completion of fd redirect after find command limited to directories (forwarded from Lionel Elie Mamane) (forwarded from Ian Macdonald)

2005-09-10 Thread Chet Ramey

 find  foo
ask for autocompletion there, only directories are taken into
account.
 ls  foo
or
 cat  foo
autocomplete to all filenames (directories and non-directories), as it
should.
 
 
 This is a limitation of the completion mechanism. There's no easy way to
 detect redirection at arbitrary positions on the command line and act
 accordingly. To do so would require each command completion function to
 handle redirection internally. A more generic solution is required at
 the bash level itself.

And what do you suggest that generic solution should be?  Don't call
the programmable completion code at all if the previous token appears
to be a redirection?

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live Strong.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]