Lsd: bash and zsh not completing filenames

Created on 17 Jun 2020  路  8Comments  路  Source: Peltoche/lsd

Expected behavior

When I type lsd --date='date' <TAB> the zsh completion lists all files in the current directory.

Actual behavior

When I type lsd --date='date' <TAB> the zsh completion inserts a dash instead. A consecutive <TAB> then lists all options (as a completion for -*).

kinbug

Most helpful comment

Ahh, I see your point. Guess we could do a flag instead of a subcommand. I am not sure if this is a common pattern but I have seen eval $(lsd --gen-completions) like things. Dropping something like this in a .bashrc should let them load the completions for the specific version they will be using.

All 8 comments

I have tried the lsd --date='date' <TAB> but it shows the files like this:

image

could you add:

  1. the version of lsd
  2. the version of zsh
  3. did you use some extensions like oh-my-zsh or something others

I totally forgot about that issue and I'm currently unable to reproduce it. Back then I somehow had at least some completions (not sure if built-in or via zsh-completions), but right now I don't have any at all.

So the bug is kind of obsolete now, since the default zsh behaviour of suggesting directories and files (as stated in the "expected behavior" bug description) now kicks in instead of suggesting lsd options 馃槃

Ultimately I would like to have completions for the options, but only if I insert a dash and then hit tab, and otherwise have completions for the files.

But honestly at this point I don't really care much anymore 馃槈 I can live without the option completions as long as the file completions work as expected. Feel free to close this if you think it shouldn't be investigated any further.

clap which is lsd used as cli framework can auto-generate the completions, here is the crate and example:

https://github.com/clap-rs/clap/tree/master/clap_generate

the only question is when should we generate the completions, prebuilt and can be used by curl, subcommand to generation on the fly or something else.

I think subcommand would be better as that way it would be easier to keep in sync for the user.

but subcommand may be confused with the files args

Ahh, I see your point. Guess we could do a flag instead of a subcommand. I am not sure if this is a common pattern but I have seen eval $(lsd --gen-completions) like things. Dropping something like this in a .bashrc should let them load the completions for the specific version they will be using.

Hey, this is something that I forgot earlier. lsd actually ships with completions in the release. I forgot about it as this is not a feature that I was using a lot.

The issue is that lsd does not seem to be doing file name completions in bash and zsh. fish seems to work well though. Will look into what might be going on in the build script.

Looks like this is related to https://github.com/clap-rs/clap/issues/568.

Was this page helpful?
0 / 5 - 0 ratings