LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-04-2011, 08:54 AM   #1
KaosX
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Rep: Reputation: 0
Argument tab completion


I'm using compgen and complete to generate a list of client names for some functions that I use.

Code:
function complj()
{
	COMPREPLY=()
	curw=${COMP_WORDS[COMP_CWORD]}
        COMPREPLY=($(compgen -W '$arglist' -- $curw))
	return 0
}
Then I use the following to "provide" the completion list to my functions

Code:
complete -F complj -o "nospace" "feeds"
What I'd like to do is make it so if I'm running any script that same list would be available to that script as arguments.

I've tried variations of the following

Code:
complete -F complj -o "nospace" "bash"
complete -F complj -o "nospace" "/bin/bash"
complete -F complj -o "nospace" "./"
but none work, and I know it's me at fault.

Even after reading the man page I'm just not getting it.

Any suggestions/examples/further research material that anyone might suggest?

Thanks!
 
Old 04-08-2011, 04:50 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
You can specify a default compspec with -D:
Quote:
If those searches do not result in a compspec, any compspec defined with the -D option to complete is used as the default.

Programmable Completion
But I don't think there is any way to specify a compspec for all scripts.
 
  


Reply

Tags
bash



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using TAB completion in a script mahmoodn Linux - General 2 07-29-2010 12:56 AM
is there a genearlization of <TAB> completion glinux Linux - Newbie 1 03-03-2009 12:13 AM
no tab completion maddocks AIX 2 12-27-2007 01:10 PM
Tab-completion kzr_merchant Programming 2 12-17-2007 04:00 PM
Tab completion with sudo extrasolar Slackware 8 08-22-2006 02:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration