zetharx Posted May 26, 2010 Share Posted May 26, 2010 I am trying to find if PHP can possibly support this. I want to have some PHP script which will create some interactive behavior much like bash. for example $ sudo apt When I hit <tab> twice, I'll get all the possible completions. $ sudo apt apt apt-get apt-add-repository aptitude apt-cache aptitude-create-state-bundle apt-cdrom aptitude-run-state-bundle apt-config apt-key aptd apt-mark aptdcon apt-sortpkgs apt-extracttemplates apturl apt-ftparchive apturl-gtk and likewise $ sudo apt-g <tab> once will auto-complete the only available command $ sudo apt-get Is it possible to get PHP watching the input on the command line and reacting to <tab> with similar behavior? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/203002-php-cli-script-interactive-utility/ Share on other sites More sharing options...
mattal999 Posted May 26, 2010 Share Posted May 26, 2010 You will need JavaScript, and I suggest using jQuery Autocomplete or something similar. You will need PHP for the backend to return results using AJAX calls, but the front-end can be done in entirely JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/203002-php-cli-script-interactive-utility/#findComment-1063768 Share on other sites More sharing options...
premiso Posted May 26, 2010 Share Posted May 26, 2010 Umm, mattal999, he is talking about the CLI (Command Line Interface) this is seperate from the PHP / Webserver. To answer your question zethrax, no you cannot. As those programs are coded into the kernel and programmed to be triggered with the tab. If, however, you really want this feature, you can compile the kernel with your program and auto-completeion items for the tab when that command is in the shell. But other then that I know of no means to do what you are wanting. Quote Link to comment https://forums.phpfreaks.com/topic/203002-php-cli-script-interactive-utility/#findComment-1063770 Share on other sites More sharing options...
zetharx Posted May 26, 2010 Author Share Posted May 26, 2010 thank you very much premiso Quote Link to comment https://forums.phpfreaks.com/topic/203002-php-cli-script-interactive-utility/#findComment-1063772 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.