team icon indicating copy to clipboard operation
team copied to clipboard

Create cargo template as used in the book

Open killercup opened this issue 7 years ago • 3 comments

The book currently refers to a template you can get with cargo-generate to start writing your CLI crate.

This template repo doesn't exist! We should crate one.

Feel free to be inspired by quicli.

killercup avatar Jul 30 '18 12:07 killercup

@Keats has a pretty neat template (for kickstart) here: https://github.com/Keats/rust-cli-template

killercup avatar Aug 01 '18 10:08 killercup

Created an initial template here

We need to discuss which features should go into the template.

Dylan-DPC-zz avatar Aug 17 '18 15:08 Dylan-DPC-zz

Here's example output generated by my own CLI generator (example, template, generator). Some notable features include:

  • exitfailure integration for a series of error causes to be shown.
  • human-panic integration
  • colored CLI output through structopt
  • logger + log levels enabled by default
  • autocompletion
  • structured error definitions for the lib portion of the app

Some things I wish were better:

  • man page generation (hopefully soon)
  • exitfailure doesn't use the log crate, which means logs can be inconsistent.
  • human-panic does not show the error that caused the crash, which is not ideal during development.
  • all dependencies for the lib portion of the crate must also be build dependencies. This almost feels like a bug, but I haven't been able to figure out how to solve it.

yoshuawuyts avatar Aug 17 '18 17:08 yoshuawuyts