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

Add an example of a negative flag (i.e. --no-verbose) #281

Merged
merged 1 commit into from Nov 26, 2019

Conversation

TeXitoi
Copy link
Owner

@TeXitoi TeXitoi commented Nov 20, 2019

Question from #280

@CreepySkeleton
Copy link
Collaborator

Frankly, I don't think that we should attempt to document usage of clap::Arg methods on main docs.rs page. It's just there are too many clap::Arg methods and a lot of clever tricks to do.

I would like to propose a separate "structopt cookbook" containing a set of handy tips and tricks, say, Tips and Tricks.md file in github repo.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 20, 2019

until now, I've collected in the example "classical" questions about use cases, mainly from questions as this one. People seems to look at it, and if not, I just point to the example if such a question arrise.

Then, if you want to write a Tips ans tricks.md, feel free to propose such a PR, I think it would be a great addition.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 20, 2019

And examples doesn't go in docs.rs afaik, and having these examples compiling is also of interest.

@CreepySkeleton
Copy link
Collaborator

CreepySkeleton commented Nov 20, 2019

Oh, you mean examples folder? It makes sense, actually, it's just hard to search with Ctrl+F, perhaps a separate readme in examples folder would help?

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 20, 2019

Yep, this is a new file in the example folder

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 22, 2019

I don't get the Ctrl+F thing.

OK for a README.md in the examples folder, but i think that's not related to this PR.

@CreepySkeleton
Copy link
Collaborator

I don't get the Ctrl+F thing.

I mean, there's no easy way to perform a search. Examples are just a bunch of *.rs files and there's no description; if I'd needed something specific I would have to pick a file based on its name only, most likely, not just one (I'm speaking from experience).

OK for a README.md in the examples folder, but i think that's not related to this PR.

Yeah, this is meant to address the lack of description. For example:

# Collection of useful tips and tricks

### Parse "true" or "false" literals as `bool` flag

[Short description, detailed description goes into the file]
Parse `"true"` or `"false"` literals as CLI flag and turn it into a `bool` field.

[Full example](link to rs file)  
[Origin](link to issue/PR/comment)

[Short snippet, nothing fancy, core idea only, detailed description should be put into the corresponding file]
```rust
type Flag = bool;

#[derive(StructOpt)]
struct Opt {
    flag: Flag
}

... other entries, sorted alphabetically

This way we can direct the browser to examples folder and get a quick overview about the stuff contained.
Also, if this way I would be able to hit Ctrl+F, search for "true" and instantly find exactly what I want.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 22, 2019

OK, but I'd prefer no code in the README, that's a pain to maintain.

@CreepySkeleton
Copy link
Collaborator

OK, but I'd prefer no code in the README, that's a pain to maintain.

I thought these examples never change spontaneously, only on major releases.

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 22, 2019

That's easy to forget to change the README at a new breaking change release, or when you update the code of the example, or when you do a bad copy/paste that doesn't compile. As the example must be short, reading the example should be accessible.

@CreepySkeleton
Copy link
Collaborator

Hey, @TeXitoi , is this blocked on something so you can't merge it?

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

I was waiting for you to merge or approve the merge request. We need to define a workflow ;-)

What about "the author of the pull request can merge himself after an approve, or a "too big" timespan without feedbacks"?

@CreepySkeleton
Copy link
Collaborator

Sure, I think 4 days would be a good "no reply" time span

@CreepySkeleton
Copy link
Collaborator

Also, I think it would be sencible to allow merges without an approval as long as it's small and it doesn't change anything in src/structopt_derive folder (examples, tests, docs...)

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

OK, deal! ;-)

@TeXitoi TeXitoi merged commit 42aa40f into master Nov 26, 2019
@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

Did you received my crates.io invitation?

@CreepySkeleton
Copy link
Collaborator

Also, where is the "approve" button here? I couldn't find it :)

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

When looking at the diff, you have an approve button

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

Review changes

@CreepySkeleton
Copy link
Collaborator

Ooops, I totally missed it. I didn't receive an email so I didn't know about it, sorry.

Review changes

Are you asking me to review some changes or keep explaining the location of "approve" button? I found it :)

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

keep explaining the location of "approve"

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

For publishing, I always publish structopt-derive and structopt at the same time with the same version, even if most of the time structopt doesn't need an update. That's clearer if the version numbers are the same.

So, the publish workflow is, for now:

  • edit CHANGELOG.md, Cargo.toml and structopt-devive/Cargo.toml to update the versions
  • commit locally on master
  • cd structopt-derive && cargo publish
  • cd .. && cargo publish
  • git tag v0.3.5
  • git push origin master && git push origin --tags
  • notify the persons on the merge request if I'm not lazy

We can change that if you have a better idea.

@CreepySkeleton
Copy link
Collaborator

That's a good workflow, but I would advice to do tag && push before publish so we could have a CI run on the same comment as cargo publish.

Also, maybe I'll even find some time and write a script to automatize stuff, mundane manual actions tend to have some really unpredictable mistakes snaked in :) Hail machines, hail SkyNet!

@CreepySkeleton
Copy link
Collaborator

And, just so you know, if you need to get in touch with me for some reason that is unrelated to github (like the crates.io invite) you should send me an email, I typically check it at least once a day. the same if you're need a reply from me as soon as possible.

@CreepySkeleton
Copy link
Collaborator

Do you still need example-negative-branch?

@TeXitoi TeXitoi deleted the example-negative-flag branch November 26, 2019 18:01
@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

good catch, removed

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

OK, the one listed in your profile?

@CreepySkeleton
Copy link
Collaborator

Yep

@TeXitoi
Copy link
Owner Author

TeXitoi commented Nov 26, 2019

You can also join me by email at texitoi AT texitoi DOT eu if needed.

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.

None yet

2 participants