Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cargo env simplified #778

Closed
ishitatsuyuki opened this issue Dec 17, 2016 · 4 comments
Closed

Feature: cargo env simplified #778

ishitatsuyuki opened this issue Dec 17, 2016 · 4 comments
Labels
C-enhancement Category: Raise on the bar on expectations
Milestone

Comments

@ishitatsuyuki
Copy link

This is a proposal of a more clean wrapper around Cargo.toml.

Right now the macro only supports version and author. If all things supported (package name, description) are taken into place, this would be cool.

Macro proposal: a wrapper around clap_app

clap_cargo_app!(
    // package name, version, authors, descriptions are taken into place, if applicable
    (@arg ...)
)
@kbknapp
Copy link
Member

kbknapp commented Dec 18, 2016

Great idea! I think this would require each of those be implemented as separate macros, but you're right, I'd also like a single macro to pull in everything. Let me mull over the implementation over the holidays and I'll post back here.

The only thing I don't really want to do is have a clap_app! and clap_cargo_app! macro. I'd like to either combine these into the clap_app! macro, or do something like a app_with_defaults! macro.

i.e.

let app = app_from_crate!()
    // continue builder like normal

The above being the same as

let app = App::new(crate_name!())
    .version(crate_version!())
    .author(crate_authors!())
    .about(crate_description!())
    // other builders like normal.

@kbknapp kbknapp added C: macros C-enhancement Category: Raise on the bar on expectations labels Dec 18, 2016
@kbknapp kbknapp added this to the 2.20.0 milestone Dec 27, 2016
@kbknapp
Copy link
Member

kbknapp commented Dec 31, 2016

ToDo

  • Add crate_description!
  • crate_description! docs
  • Add crate_name!
  • crate_name! docs
  • Add app_from_crate!
  • app_from_crate! docs

@kbknapp
Copy link
Member

kbknapp commented Dec 31, 2016

Big thanks to @nabijaczleweli for implementing this 👍

@nabijaczleweli
Copy link
Contributor

I aim to please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

3 participants