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 multi-app completion hook generation (not default behavior) #48

Conversation

aik099
Copy link
Contributor

@aik099 aik099 commented May 13, 2015

The --multiple|-m option is added, that will:

  • use $1 (the path of app user has pressed TAB for) instead of app, for which hook was generated
  • imply --program basename(/absolute/path/to/app) option, when --program option is absent, because when completing for multiple apps the alias should always be present

Usage: /path/to/app _completion -gm results in hook generated for app alias and works even if you have 2 app in different projects.

I've also updated hook factory tests to check syntax for all generateHook parameter combinations. Before it was checking syntax for case, when all parameters were given.

Closes #44

@@ -129,6 +131,12 @@ public function generateHook($type, $programPath, $programName = null)
// Use the program path if an alias/name is not given
$programName = $programName ?: $programPath;

if ($multiple) {
$completionCommand = '${1} _completion';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{$1} works under BASH, but doesn't resolve to anything under ZSH. Just using $1 works correctly on both BASH and ZSH.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking that out.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1328f12 by the way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the first thing I've checked before wanting to to ask you why you've merged this PR and checked the merge result to find the error instead tell me to fix that and merging only afterwards.

@stecman stecman merged commit e0f76c6 into stecman:master May 17, 2015
stecman added a commit that referenced this pull request May 17, 2015
@aik099 aik099 deleted the 44-support-completion-wrapper-for-multi-app-completion branch June 13, 2015 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support completion wrapper for multi-app completion
2 participants