dotboris / alt

A simple version manager tool for switching between different versions of commands
MIT License
86 stars 5 forks source link

Shell completion #41

Closed dotboris closed 4 years ago

dotboris commented 5 years ago

Clap support generating shell completion for apps. I believe that this would make alt a whole lot more usable since users will no longer need to remember command names and flags.

Documentation: https://docs.rs/clap/2.32.0/clap/struct.App.html#method.gen_completions

dotboris commented 5 years ago

The build now generates the completion scripts, the problem is that we're not really releasing them yet.

dotboris commented 5 years ago

The shell completion has been generated with the build for a while now. Its main issue is that it was never packaged. This is because we were only packaging a single gzipped binary.

Things have moved on since:

  1. We're packing deb packages
  2. I'm working on packaging a tarbal in #85 (will likely be split in two PRs)
  3. I'm working on a homebrew formula / tap for alt

In all these cases, we have the opportunity to actually package and ship the completions.

Problem is: I don't have a good way to find the OUT_DIR variable in build.rs. It's runtime generated and it changes a lot.

This problem is discussed here: https://github.com/rust-lang-nursery/cli-wg/blob/master/logs/2018-05-03-packaging.md#finding-buildrs-artifacts

There's also cargo-deb that has a workaround for this: https://github.com/mmstick/cargo-deb/blob/master/example/build.rs#L7-L13

dotboris commented 4 years ago

All shipped packages + manual install have shell completion. I'm calling this good enough