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

chore: make batch interactive #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nicolasburtey
Copy link
Member

No description provided.

@nicolasburtey nicolasburtey force-pushed the chore-make-batch-interactive branch from 47c3f07 to d6398cd Compare September 1, 2022 21:47
Comment on lines +201 to +211
println!("do you want to confirm? y/n");

let mut input = String::new();

io::stdin()
.read_line(&mut input)
.expect("error: unable to read user input");

if !(input.trim() == "y" || input.trim() == "yes") {
bail!("didn't confirm batch payment. exiting")
}
Copy link
Member

Choose a reason for hiding this comment

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

TBH I've never written any rust that had interaction like this so I don't know if there is a library or a standard convention on how to do this. Would have to go looking at other code to know if there is a better way.

Without doing any research I'd say this looks fine.

You could avoid the double call to trim but afaict it doesn't allocate so is negligible for this use-case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@sandipndev
Copy link
Member

@eshanvaid this could be a good PR to take inspiration from about how to bring about batch payment.

@sandipndev sandipndev force-pushed the main branch 4 times, most recently from 64ab5f2 to 330afe0 Compare August 3, 2023 07:47
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.

3 participants