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

Allow opting out of clap default features. #46

Merged
merged 2 commits into from
Jan 23, 2018
Merged

Allow opting out of clap default features. #46

merged 2 commits into from
Jan 23, 2018

Conversation

ski-csis
Copy link
Contributor

Clap comes with some colorful default features, which are not always useful or wanted, so allow opting out of them.

Clap comes with some colorful default features, which are not always
useful or wanted, so allow opting out of them.
@TeXitoi
Copy link
Owner

TeXitoi commented Jan 23, 2018

Thanks for the contribution!

I'm not a cargo feature wizard, thus I have a few questions:

  • is the default the same as before? (I suspect yes)
  • How can you cherry-pick clap feature forward structopt? (a note in the documentation about that would be a great addition).

@ski-csis
Copy link
Contributor Author

Yup, this leaves the default unchanged (just checked with a fresh test-crate for good measure :).

I added a note on how to disable the color-stuff in the README, was that where you meant?

@TeXitoi
Copy link
Owner

TeXitoi commented Jan 23, 2018

Mmm, thus, or you desactivate everything, or nothing? You can't desactivate color but activate suggestions?

@ski-csis
Copy link
Contributor Author

I can add features here like:

clap-color = ["clap/color"]
clap-suggestions = ["clap/suggestions"]

Then you can use default-features = false, features = ["clap-color"] to get color w/o suggestions.

But, do you think it's likely anyone would use that?

@TeXitoi
Copy link
Owner

TeXitoi commented Jan 23, 2018

That may be overkill. Let's do it simple first.

README.md Outdated
[dependencies]
structopt = { version = "0.1.0", default-features = false }
structopt-derive = "0.1.0"
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to disable all the clap features (color, suggestions...), add [...]

I would prefer this doc to be in src/lib.rs than in README.md.

After that, I'll merge it.

Thanks!

@ski-csis
Copy link
Contributor Author

Like this?

@TeXitoi TeXitoi merged commit 00a1e13 into TeXitoi:master Jan 23, 2018
@TeXitoi
Copy link
Owner

TeXitoi commented Jan 23, 2018

Thanks!

@TeXitoi
Copy link
Owner

TeXitoi commented Jan 23, 2018

0.1.7 published

@CAD97 CAD97 mentioned this pull request Feb 17, 2018
11 tasks
Eijebong pushed a commit to Eijebong/structopt that referenced this pull request Jan 2, 2019
@shilangyu
Copy link

How do I enable them tho? I read its "on by default" but I don't see colors nor suggestions.

[dependencies]
structopt = "0.3"

@CreepySkeleton
Copy link
Collaborator

Weird they should be on.

Try

[dependencies]
structopt = { version = "0.3", features = ["color", "suggestions"] }

@shilangyu
Copy link

Nope, nothing. I don't want to spam anymore here, I'll open a separate issue, just last question: Was I supposed to turn on the features explicitly in rust code? Or including them in Cargo.toml is supposed to be all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants