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

gw completion not working on Linux #14

Open
rwinch opened this issue Feb 7, 2017 · 13 comments
Open

gw completion not working on Linux #14

rwinch opened this issue Feb 7, 2017 · 13 comments

Comments

@rwinch
Copy link

rwinch commented Feb 7, 2017

It would be nice if the completion worked for https://github.com/dougborg/gdub (or something similar)

@eriwen
Copy link
Contributor

eriwen commented Feb 7, 2017

@rwinch gw should be completed the same as gradle achieved by commits 55303d5 (zsh) and 1468230 (bash)

If for some reason that's not working for you, could you please tell me a bit about your environment and exactly what command you're trying to complete so I can help debug?

Please note that these scripts don't yet support completion from a subproject directory #3.

@rwinch
Copy link
Author

rwinch commented Feb 7, 2017

Thanks for the fast reply!

I am using zsh 5.2 (x86_64-ubuntu-linux-gnu). I have the lastest oh-my-zsh installed but I have disabled all plugins.

The project I'm using leverages Gradle 3.3. If I type:

./gradlew --v

and press tab it completes to

./gradlew --version

If I type:

gw --v

and press tab nothing happens.

@eriwen
Copy link
Contributor

eriwen commented Feb 8, 2017

Thanks for the thorough context, Rob.

gw --v[TAB] completes correctly for me on macOS. I'll need to check my linux VM soon.

In the meantime, would you tell me if task completion works with gw?

@eriwen eriwen changed the title Add support for gdub gw completion of arguments not working on Linux Feb 8, 2017
@rwinch
Copy link
Author

rwinch commented Feb 8, 2017

@eriwen Thanks again for your fast response.

Task completion works for ./gradlew, but pressing gw [TAB] makes it autocomplete my path instead of tasks.

It may be useful to know I am using Ubuntu 16.10.

NOTE: I am running this in the root project of spring framework's master branch with sha f2967467e08a969a4e338c7b9a342bb2dda7f971

@eriwen
Copy link
Contributor

eriwen commented Feb 11, 2017

@rwinch Weird question: Does completion complete --status for you?

@rwinch
Copy link
Author

rwinch commented Feb 13, 2017

@eriwen No it does not. The following does not complete:

gw --statu[TAB]

However the following will complete:

./gradlew --statu[TAB]

So will the following

gradle --statu[TAB]

@eriwen eriwen added the a:bug label Feb 19, 2017
@eriwen eriwen changed the title gw completion of arguments not working on Linux gw completion not working on Linux Feb 24, 2017
@eriwen
Copy link
Contributor

eriwen commented Feb 24, 2017

I'm able to reproduce this issue, and it seems like gw completion is being overridden. If I hit Ctrl-X ? instead of [tab] I get debug output that shows that completion is ignored and defaults to completing files.

I expect that explicitly declaring gw completion in ~/.zshrc with zstyle may do the trick. I can dig up the command for this after a bit.

@rwinch
Copy link
Author

rwinch commented Mar 1, 2017

Thanks for the follow up :)

@NielsDoucet
Copy link
Contributor

NielsDoucet commented May 17, 2017

when gw is an alias, it could also be completed if we check it with type:
if hash gw 2>/dev/null; then
complete -F _gradle gw
elif type gw &>/dev/null; then
complete -F _gradle gw
fi

The only issue is that it's not guaranteed to be an alias for gradlew, so the output of the type command might have to be parsed to guarantee we complete on the correct alias:
✘ 13:53 ~/git/platform-infrastructure [ bugfix/INFRA-3119 | ⚑ 8 ] $ type gw
gw is aliased to ./gradlew'`

@wolfs
Copy link
Member

wolfs commented Aug 11, 2017

Adding

compdef gw='gradle'

to ~/.zshrc seems to do the trick for me.

@staffanf
Copy link

@eriwen Any news on this? Can't the workraound that @wolfs mentioned to work either.
So basically I never use the completion since gw is sp much better than "./gradlew".
I also tend to have my gw aliased to this function:

function build_gradlew() {
  if [[ -f ../gradlew ]]; then
    nice -n11 ../gradlew "$@";
  else
   nice -n11 ./gradlew "$@";
  fi
};

But even when removing this, I can't get it to work.

@NielsDoucet
Copy link
Contributor

35b500a

This was implemented in bash last june.
Not sure about zsh support.

@QinMing
Copy link

QinMing commented Apr 2, 2019

@wolfs 's solution #14 (comment) still works for me,
and is the only work around I found so far.

I tried running the if branch directly

if hash gw 2>/dev/null || alias gw >/dev/null 2>&1; then echo yes; fi
# output:
yes

So this line has been already executed complete -F _gradle gw

Don't know what's wrong. Maybe it's a conflict with some other programs.

I'm using Macbook Pro macOS Mojave 10.14.3
zsh 5.5.1 (x86_64-apple-darwin17.5.0)

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

No branches or pull requests

6 participants