nikolassv / bartib

A simple timetracker for the command line. It saves a log of all tracked activities as a plaintext file and allows you to create flexible reports.
GNU General Public License v3.0
636 stars 34 forks source link

`generate`/`gen`/`completions` command: Generate shell completions #44

Open simonsan opened 5 months ago

simonsan commented 5 months ago

I see that you are using clap for the CLI, there is https://crates.io/crates/clap_complete to automatically generate shell completions. It would be nice, to be able to generate completions for different shells by just calling bartib completions >> {my_shell_profile}. Here is a possible implementation: https://github.com/rustic-rs/rustic/blob/main/src/commands/completions.rs

Depending on if you want to further generate other files (e.g a bartib.toml for configuration of e.g. style of reports, default timezones etc.) it would be useful to have that under bartib gen completions (in the future maybe there could be a bartib gen configor just the top-level bartib completions.

nikolassv commented 5 months ago

Thank you for bringing this crate to my attention. I didn't know it existed. This looks like something bartib should definitely have.