Skip to content

Commit

Permalink
feat(no_cargo): add no_cargo feature to disable Cargo-env-var-depende…
Browse files Browse the repository at this point in the history
…nt macros (#786)
  • Loading branch information
nabijaczleweli authored and kbknapp committed Dec 28, 2016
1 parent eb1d79d commit 6fdd2f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ unstable = [] # for building with unstable clap features (doesn't require nig
nightly = [] # for building with unstable Rust features (currently none)
lints = ["clippy"] # Requires nightly Rust
debug = [] # Enables debug messages
no_cargo = [] # Enable if you're not using Cargo, disables Cargo-env-var-dependent macros

[profile.release]
opt-level = 3
Expand Down
4 changes: 2 additions & 2 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl<'a, 'b> App<'a, 'b> {
#[deprecated(since="2.14.1", note="Can never work; use explicit App::author() and App::version() calls instead")]
pub fn with_defaults<S: Into<String>>(n: S) -> Self {
let mut a = App { p: Parser::with_name(n.into()) };
a.p.meta.author = Some(crate_authors!());
a.p.meta.version = Some(crate_version!());
a.p.meta.author = Some("Kevin K. <kbknapp@gmail.com>");
a.p.meta.version = Some("2.19.2");
a
}

Expand Down
2 changes: 2 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ macro_rules! arg_enum {
/// .get_matches();
/// # }
/// ```
#[cfg(not(feature="no_cargo"))]
#[macro_export]
macro_rules! crate_version {
() => {
Expand Down Expand Up @@ -413,6 +414,7 @@ macro_rules! crate_version {
/// .get_matches();
/// # }
/// ```
#[cfg(not(feature="no_cargo"))]
#[macro_export]
macro_rules! crate_authors {
($sep:expr) => {{
Expand Down

0 comments on commit 6fdd2f9

Please sign in to comment.