-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for more shell build-in completions #33
Comments
More built-in completions would be good, and they would certainly need to be implementations of
All completions should to be implemented in PHP unless there is a really good reason for doing otherwise. The path completion built-in is the only behaviour deferred to the parent shell at the moment, and there is good reason for it being part of the hook (explained below). If we were going to provide username completion, it would look something like this: class SystemUsersCompletion implements CompletionInterface
{
public function run()
{
exec('cat /etc/passwd | grep -v "^#" | cut -d":" -f1', $usernames);
return $usernames;
}
} The PHP implementation exception for Currently this library does defer to the shell hooks for
|
Interesting, what For example:
I expect current working directory to be |
A process always starts with its current working directory set the same as the process that created it.
This library doesn't change the working directory, so completion is always in the context of the directory you are in when you trigger completion - regardless of where the program/code is located (unless user-code changes the directory of course). |
OK. About The |
exec("bash -c 'compgen -u'"); Just playing around with this now I can't figure out what determines the shell PHP uses with |
On Ubuntu |
The
compgen
is interesting program in Bash, that provides auto-complete for various things in the system. For example:-a
means Names of alias-b
means Names of shell builtins-c
means Names of all commands-d
means Names of directory-e
means Names of exported shell variables-f
means Names of file and functions-g
means Names of groups-j
means Names of job-k
means Names of Shell reserved words-s
means Names of service-u
means Names of userAlias names-v
means Names of shell variablesMaybe there is something similar in ZSH: http://www.csse.uwa.edu.au/programming/linux/zsh-doc/zsh_23.html
What I think we should do is to abstract shell interaction on PHP level and not via IFs in generated hook. Right now if we want to auto-complete usernames in system we need to update the hook and that's not very convenient.
The text was updated successfully, but these errors were encountered: