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 flag -y as a shortcut for --skip-confirm #1127

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

AlexD10S
Copy link
Contributor

PR for this issue: Add flag -y that says Yes to every prompt (#1062)

It adds -y as a shortcut for --skip-confirm.
Examplo of use:
cargo contract instantiate --suri //Alice --constructor new --args true -x -y instead of cargo contract instantiate --suri //Alice --constructor new --args true -x --skip-confirm

Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

As I understood the spec from #1062, this should be a new flag which should skip both --skip-dry-run and --skip-confirm.

@AlexD10S
Copy link
Contributor Author

As I understood the spec from #1062, this should be a new flag which should skip both --skip-dry-run and --skip-confirm.

My mistake then. I understood it as just a shortcut, but a same logic as the --skip-confirm to skip when prompt the user to confirm the transaction submission.

I am going to modify it to add it as a new flag, that skips both --skip-dry-run and --skip-confirm.

@ascjones
Copy link
Collaborator

We should clarify then. @cmichi ?

@cmichi
Copy link
Collaborator

cmichi commented May 24, 2023

Yup, I meant what Andrew said.

@cmichi
Copy link
Collaborator

cmichi commented May 24, 2023

@AlexD10S Don't forget updating the CHANGELOG.md.

@AlexD10S
Copy link
Contributor Author

Does make sense to have at the same time y with one of the flags skip_confirm or skip_dry_run? I don't see a problem, but in case is better to restrict the use will be done adding conflicts_with.

    /// Before submitting a transaction, do not dry-run it via RPC first.
    #[clap(long, conflicts_with = "y")]
    skip_dry_run: bool,
    /// Before submitting a transaction, do not ask the user for confirmation.
    #[clap(long, conflicts_with = "y")]
    skip_confirm: bool,

@ascjones
Copy link
Collaborator

Does make sense to have at the same time y with one of the flags skip_confirm or skip_dry_run? I don't see a problem, but in case is better to restrict the use will be done adding conflicts_with.

    /// Before submitting a transaction, do not dry-run it via RPC first.
    #[clap(long, conflicts_with = "y")]
    skip_dry_run: bool,
    /// Before submitting a transaction, do not ask the user for confirmation.
    #[clap(long, conflicts_with = "y")]
    skip_confirm: bool,

Yes I think it should have conflicts_with

@AlexD10S AlexD10S requested a review from ascjones May 25, 2023 08:59
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, revisiting this.

After reading the issue again, I believe it incorrectly states that --skip-dry-run is saying yes to a prompt. In fact, what it does is prevent the pre tx submission dry-run which is used for gas estimation. This can be used if the user wants to submit a transaction with their own custom limits, or if the dry-run fails and they want to submit the tx anyway.

Therefore I believe it doesn't make sense to group it with --skip-confirm. It may be true that when manually specifying gas limits the user then wants to skip the confirm step, but I think that is okay to have as a separate option still.

skip_dry_run: bool,
/// Before submitting a transaction, do not ask the user for confirmation.
#[clap(long)]
#[clap(long, conflicts_with = "y")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Possibly we could change this whole PR just by adding y as the short for skip-confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries, is great to have your feedback.
This was my initial though too. Do you suggest to come back to the initial commit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes looks good 👍

@AlexD10S AlexD10S force-pushed the alexd10s/flag-y-skip-prompt branch from d41c0a6 to 7be4610 Compare June 6, 2023 16:14
@ascjones ascjones merged commit 4f1840a into master Jun 13, 2023
@ascjones ascjones deleted the alexd10s/flag-y-skip-prompt branch June 13, 2023 15:46
This was referenced Jul 26, 2023
@smiasojed smiasojed mentioned this pull request Mar 4, 2024
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