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

use clap parser in cosmos examples #884

Merged
merged 2 commits into from
Jul 4, 2022

Conversation

yoshuawuyts
Copy link
Contributor

This is a relatively small change, but it moves the cosmos examples from our custom parsing code to the commonly-used clap command line parser crate. The benefit of doing this is that it removes bespoke parsing code from inside fn main to a declarative struct at the top of the file. The focus of the examples should be on how to use the Azure APIs, and not having several lines of command line parsing code at the start of each fn main should make it a lot easier to skip to the core of the examples.

I was reading over some examples, and found myself distracted by the initial parsing code in each file. Taken as a whole I think this should make the examples a lot easier to follow. Thanks!

@yoshuawuyts yoshuawuyts requested review from rylev and cataggar July 1, 2022 15:30
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

Looks good!

Two thoughts:

  • I'm slightly worried that clap will make compile times for examples worse.
  • Maybe we could share some of the auth related functionality across the different examples.


let doc = MySampleStruct {
id,
id: format!("unique_id{}", 100),
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it was this way before, but "unique_id100".to_owned() might be better.

@rylev rylev merged commit fd5de99 into Azure:main Jul 4, 2022
@yoshuawuyts yoshuawuyts deleted the cosmos-clap-examples branch July 4, 2022 14:05
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.

2 participants