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

Add support for bash completion #160

Closed
wants to merge 3 commits into from
Closed

Conversation

frou
Copy link

@frou frou commented Sep 12, 2018

Hi there - give this a try. It can be loaded by adding this to one's .bash_profile:

. "$GOPATH/src/github.com/magefile/mage/bash_completion"


Mage's own magefile could probably have a target to make the above step unnecessary. It would have to find the system's bash_completion.d directory (e.g. /usr/local/etc/bash_completion.d) and create a symlink in it to our script, which would result in automatic loading.

Fixes #113

@natefinch
Copy link
Member

Yeah, I think most go programs that do this have a command that'll install the file in the necessary place. I'll give this a test and then maybe look at how other commands deploy theirs.

@natefinch natefinch closed this Sep 14, 2018
@natefinch natefinch reopened this Sep 14, 2018
@natefinch
Copy link
Member

Works well on my machine. I kinda feel like this might belong better as docs on the website... I worry that trying to deploy this automatically is going to be more complexity than I really want in Mage itself.

@frou
Copy link
Author

frou commented Sep 15, 2018

Perhaps fully automatic deployment of completion wouldn't make sense unless mage was being installed using an OS-level package manager (rather than go get).

How about this (new commit). The user can just run it if they want.

(I think if the process were even more manual than this, the number of people who would actually end up having completion would absolutely plummet).

@natefinch
Copy link
Member

Yeah, the problem is that we'd have to do a lot of work to know all the edge cases of if that directory can live somewhere else.... what happens if they use a different shell...

I'd rather have this as a good example that most people can just drop in place, and not have to try to support it when it fails for some weird OS/shell/whatever. You know there's going to be some linux person who has their bash completion directory set up on like a network share that requires a password to log into it or something crazy like that.

I like bash completion, but I don't feel like it's critical for mage. You can easily make aliases in your magefile to make commands as short as you like....

@frou frou closed this Sep 16, 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.

2 participants