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

Dynamic generation of mix commands for zsh completion. #4594

Closed
wants to merge 1 commit into from

Conversation

jinyeow
Copy link

@jinyeow jinyeow commented Nov 9, 2015

I wrote my own zsh completion file for mix today (didn't realise that oh-my-zsh already has one). I noticed that depending on the project, the mix tasks can change because of dependencies like phoenix or ecto.
E.g. usually you wouldn't have 'mix phoenix.server' except in the project directory for a phoenix web app.
This is my solution for "dynamic" generation of the _1st_arguments:
I replaced most of the _1st_arguments with just

"${(@f)$(mix help | egrep "^mix " | tail -n+2 | sed 's/^mix //;s/\s\+#\s/:/')}"

The above line will allow the zsh user to autocomplete all available mix tasks. I just finished this and thought I should submit it for other oh-my-zsh users.

I wrote my own zsh completion file for mix today. I realised that depending on the project the mix tasks can change because of dependencies like phoenix or ecto.
E.g. usually you wouldn't have 'mix phoenix.server' except in the project directory for a phoenix web app.
This is my solution for "dynamic" generation of the _1st_arguments:
So, I replaced most of the _1st_arguments with just 

    "${(@f)$(mix help | egrep "^mix " | tail -n+2 | sed 's/^mix //;s/\s\+#\s/:/')}"

The above line will allow the zsh user to autocomplete all available mix tasks. I just finished this and thought I should submit it for other oh-my-zsh users.
@mcornella
Copy link
Member

Already in mix-fast.

@mcornella mcornella closed this Apr 25, 2018
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.

None yet

2 participants