Closed aik099 closed 9 years ago
Do you know if there's any identifying about a Symfony app other than the script being ./app/console
? I've had a think about this in the past, but haven't actually written anything for it.
I have no idea. Right now I'm using universal bash script (see https://gist.github.com/aik099/1a72ab19beb3038fbb3e) that would auto-complete for console
by calling console list --xml
app in current directly and getting output from it. We can use current directory option somehow too to generate directory agnostic completion script.
Right main completion line (at least in Bash hook) looks like this:
RESULT="$(/home/alex/web/d/in-portal.53x/in-portal _completion)";
Then we can use some PHP code here to use actual invoked script name instead of hardcoding /home/alex/web/d/in-portal.53x/in-portal
used to generate completion hook initially.
Or we actually can support static hook generation once (not at every shell login as now) and then user can place it where he needs. But this is more what #30 needs.
Changing above line to this did the trick:
RESULT=$(${1} _completion);
In fact I think we can safely do this in any case because it won't hurt to use actual app to get completion for instead of app, used to generate the hook.
If we don't do this, then we should at least use $programName
instead of $programPath
in https://github.com/stecman/symfony-console-completion/blob/master/src/HookFactory.php#L143 . This way when program name is specified by user it will be used to produce completions instead of absolute path to that program. If program name isn't specified, then the program path will be used anyway. This would conflict with suggestion in #45 .
PR created.
Consider such use case:
app
executable PHP script in it's root folderapp TAB
should get project-relevant completionsCurrently I have to install completion hooks for each project separately, which isn't very user friendly.
Also I'm forced to use
-p
option because otherwise I get no completion: