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

caveats: Differentiate zsh completion files and function files #1616

Merged
merged 2 commits into from Dec 12, 2016

Conversation

Projects
None yet
2 participants
@zachwhaley
Contributor

zachwhaley commented Dec 4, 2016

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?

When installing a file to zsh/site-functions directory, it is assumed this is a zsh completion file,
and the zsh completion caveat is printed after installation.

But not all files in the zsh/site-functions directory are completion files.
Some are files for functions that can be loaded on demand with zsh's autoload command.

  • Edit Keg.completion_installed to search specifically for files in the zsh/site-functions
    directory starting with an underscore only (By convention, zsh completion files start with an underscore)
  • Add Keg.zsh_functions_installed to search for non-completion files in the zsh/site-functions
  • Add Caveats.zsh_functions_caveats to print a caveat if non-completion files have been installed
    to zsh/site-functions
Show outdated Hide outdated Library/Homebrew/keg.rb
Show outdated Hide outdated Library/Homebrew/keg.rb
@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Dec 4, 2016

Member

What software installs ZSH functions and what are they used for? Thanks!

Member

MikeMcQuaid commented Dec 4, 2016

What software installs ZSH functions and what are they used for? Thanks!

@zachwhaley

This comment has been minimized.

Show comment
Hide comment
@zachwhaley

zachwhaley Dec 4, 2016

Contributor

@MikeMcQuaid Zsh plugins and frameworks use zsh functions, and they are basically command line commands for zsh.

My little project uses a zsh function to override and enhance a command.

Contributor

zachwhaley commented Dec 4, 2016

@MikeMcQuaid Zsh plugins and frameworks use zsh functions, and they are basically command line commands for zsh.

My little project uses a zsh function to override and enhance a command.

@zachwhaley

This comment has been minimized.

Show comment
Hide comment
@zachwhaley

zachwhaley Dec 4, 2016

Contributor

Fair warning, I can't directly test these changes since I don't have a Mac with me; sorry :(

Contributor

zachwhaley commented Dec 4, 2016

Fair warning, I can't directly test these changes since I don't have a Mac with me; sorry :(

@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Dec 7, 2016

Member

@MikeMcQuaid Zsh plugins and frameworks use zsh functions, and they are basically command line commands for zsh.

My little project uses a zsh function to override and enhance a command.

My little project uses a Fish function to override and enhance a command.

@zachwhaley To make a core change we'll probably want a few example projects rather than just your personal one. Could you link to a few? Thanks!

Member

MikeMcQuaid commented Dec 7, 2016

@MikeMcQuaid Zsh plugins and frameworks use zsh functions, and they are basically command line commands for zsh.

My little project uses a zsh function to override and enhance a command.

My little project uses a Fish function to override and enhance a command.

@zachwhaley To make a core change we'll probably want a few example projects rather than just your personal one. Could you link to a few? Thanks!

@zachwhaley

This comment has been minimized.

Show comment
Hide comment
@zachwhaley

zachwhaley Dec 8, 2016

Contributor

Honestly, I don't think I'll be able to find a lot of examples for this, outside of zsh specific programs.

This PR and PR #1615 were created from issue #1594 and the discussion there.
This PR is addressing issue #1594, and I added PR #1615 from @apjanke comments about advising the user that something went to a directory that may not be on their path
For PR #1615 that path would be the users $fish_function_path

Since I thought these changes wouldn't be very big, I thought I might as well give it a try :)

Thanks!

Contributor

zachwhaley commented Dec 8, 2016

Honestly, I don't think I'll be able to find a lot of examples for this, outside of zsh specific programs.

This PR and PR #1615 were created from issue #1594 and the discussion there.
This PR is addressing issue #1594, and I added PR #1615 from @apjanke comments about advising the user that something went to a directory that may not be on their path
For PR #1615 that path would be the users $fish_function_path

Since I thought these changes wouldn't be very big, I thought I might as well give it a try :)

Thanks!

@zachwhaley zachwhaley referenced this pull request Dec 8, 2016

Merged

Add a method for installing fish function files #1615

3 of 5 tasks complete
@zachwhaley

This comment has been minimized.

Show comment
Hide comment
@zachwhaley

zachwhaley Dec 8, 2016

Contributor

I did manage to find some packages that could utilize this.

Here are a list of packages that install a zsh script to some location on the system, and then ask the user to source that file, when instead they could install those scripts to zsh/site-functions and ask the user to run an autoload on their script, like what is done in my project. I haven't verified this to be the case for every package, but it seems sensible.

(I was honestly surprise to find this many packages that weren't using zsh's autoload btw 😄)

Contributor

zachwhaley commented Dec 8, 2016

I did manage to find some packages that could utilize this.

Here are a list of packages that install a zsh script to some location on the system, and then ask the user to source that file, when instead they could install those scripts to zsh/site-functions and ask the user to run an autoload on their script, like what is done in my project. I haven't verified this to be the case for every package, but it seems sensible.

(I was honestly surprise to find this many packages that weren't using zsh's autoload btw 😄)

@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Dec 8, 2016

Member

Perfect, thanks for explaining so well. Happy to merge this when conflicts with your other (merged) PR are resolved and would ❤️ PRs for those formulae to use this after that.

Member

MikeMcQuaid commented Dec 8, 2016

Perfect, thanks for explaining so well. Happy to merge this when conflicts with your other (merged) PR are resolved and would ❤️ PRs for those formulae to use this after that.

zachwhaley added some commits Dec 4, 2016

caveats: Differentiate zsh completion files and function files
When installing a file to zsh/site-functions directory, it is assumed this is a zsh completion file,
and the zsh completion caveat is printed after installation.

But not all files in the zsh/site-functions directory are completion files.
Some are files for functions that can be loaded on demand with zsh's autoload command.

- Edit Keg.completion_installed to search specifically for files in the zsh/site-functions
  directory starting with an underscore only (By convention, zsh completion files start with an underscore)
- Add Keg.zsh_functions_installed to search for non-completion files in the zsh/site-functions
- Add Caveats.zsh_function_caveats to print a caveat if non-completion files have been installed
  to zsh/site-functions

@MikeMcQuaid MikeMcQuaid merged commit c317c3c into Homebrew:master Dec 12, 2016

3 checks passed

codecov/patch 83.33% of diff hit (target 63.10%)
Details
codecov/project 63.11% (+0.01%) compared to 276d009
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Dec 12, 2016

Member

Thanks again for your contribution to Homebrew! Without people like you submitting PRs we couldn't run this project. You rock!

Member

MikeMcQuaid commented Dec 12, 2016

Thanks again for your contribution to Homebrew! Without people like you submitting PRs we couldn't run this project. You rock!

@zachwhaley zachwhaley deleted the zachwhaley:zsh_functions_caveats branch Dec 12, 2016

@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.