Skip to content
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

Support completion wrapper for multi-app completion #44

Closed
aik099 opened this issue May 12, 2015 · 5 comments · Fixed by #48
Closed

Support completion wrapper for multi-app completion #44

aik099 opened this issue May 12, 2015 · 5 comments · Fixed by #48

Comments

@aik099
Copy link
Contributor

aik099 commented May 12, 2015

Consider such use case:

  • developer has several Symfony-based projects present on his machine
  • each project has app executable PHP script in it's root folder
  • projects can be added/removed over time
  • when in project folder typing app TAB should get project-relevant completions

Currently 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:

source <($HOME/web/d/in-portal.53x/in-portal _completion --generate-hook -p in-portal)
@stecman
Copy link
Owner

stecman commented May 12, 2015

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.

@aik099
Copy link
Contributor Author

aik099 commented May 12, 2015

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.

@aik099
Copy link
Contributor Author

aik099 commented May 12, 2015

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.

@aik099
Copy link
Contributor Author

aik099 commented May 12, 2015

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 .

@aik099
Copy link
Contributor Author

aik099 commented May 13, 2015

PR created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants