slack-cli icon indicating copy to clipboard operation
slack-cli copied to clipboard

Auto-complete channel/user names in CLI

Open regisb opened this issue 7 years ago • 5 comments

It would be awesome if the CLI could auto-complete some arguments:

slack-cli -d gene<tab>

would give:

slack-cli -d general

(as asked by @wsturgiss in #11)

regisb avatar Dec 20 '18 08:12 regisb

@wsturgiss can you try this out?

regisb avatar Dec 21 '18 19:12 regisb

Tried this today, and didn't get any autocomplete, but I reinstalled from pip. Should I pull down the repo and build it instead to get the latest changes or do you have it autoupdating in pip?

Edit: did not see the change to the readme till just now. I'm normally a zsh user, but I can test in bash for you.

wsturgiss avatar Dec 27 '18 15:12 wsturgiss

It looks like its a bit flaky in bash. I have seen 2.5 issues so far:

  1. it only works about half the time for me. Half the time, when I press tab, I get a warning bell from the terminal and it fails to bring up any autocomplete options
  2. when I type slack-cli -d j (I have a person whose name starts with j), I somehow got some filenames from the ~/ directories 2.5 Its a little slow, taking roughly a second to autocomplete.

Still really cool though. Thanks for giving this feature a crack.

wsturgiss avatar Dec 27 '18 15:12 wsturgiss

I'm a zsh user myself, and it sucks that I only got it to work for bash...

  1. it only works about half the time for me. Half the time, when I press tab, I get a warning bell from the terminal and it fails to bring up any autocomplete options

Can you please give an example, in the form of command -x arg<tab>?

  1. when I type slack-cli -d j (I have a person whose name starts with j), I somehow got some filenames from the ~/ directories

Ha, that sucks. That's probably a more general issue about argcomplete. Maybe I shouldn't have chosen to rely on a third party library.

2.5 Its a little slow, taking roughly a second to autocomplete.

I think slack-cli in general is a bit slow. There should be a cache to avoid making an http request every time we hit "tab".

I think this feature needs some more work. I'll reopen this issue.

regisb avatar Dec 27 '18 17:12 regisb

Re: issue 1, I entered slack-cli -d j<tab> and there are several users with a j at the start. They show sometimes when trying this. I wonder if the request just fails sometimes.

Re: issue 2: That hasn't happened again since my initial testing, which granted hasn't been much. Edit: I accidentally reproduced it when I mistakenly tried testing the autocomplete in a zsh tab. I think this may not be an issue in bash at all.

Re: issue 3: The slowness really is a small issue compared to the value provided by the autocomplete. 1 second is a short time to wait when compared to switching to a slack window, finding the correct username and switching back.

wsturgiss avatar Dec 27 '18 19:12 wsturgiss