LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   auto-completion - how does it work & can my script args auto-complete? (http://www.linuxquestions.org/questions/programming-9/auto-completion-how-does-it-work-and-can-my-script-args-auto-complete-192419/)

BrianK 06-11-2004 02:19 PM

auto-completion - how does it work & can my script args auto-complete?
 
I wrote a little job system that people at my office use. It essentially allows you to create a new job which just makes a bunch of directories and sets a bunch of variables; or switch between jobs which just changes the values of all the variables.

You create a job by typing "job -n foo" or you switch to a job by typing "job bar". In the latter case, the directory /job/bar exists, so I'd think it would be possible to auto-complete "bar" as the user types it. Is that possible? If so, how would you do it? My job system is just a simple tcsh script that gets sourced so the environment variables it sets stay set in the shell until the shell is closed (as opposed to when the script exits - if there's a better way, please let me know). I'm not opposed to writing the job system in another language either if that's the only way to get this working.... looking for suggestions.

Thanks!

keefaz 06-11-2004 04:51 PM

If you want to do this with script try perl cpan module Term::Complete.

do perldoc Term::Complete for more infos


All times are GMT -5. The time now is 02:05 PM.