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

fix(dre): dry run prints #653

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions rs/cli/src/ic_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl IcAdminWrapper {
);
}

async fn _exec(&self, cmd: ProposeCommand, opts: ProposeOptions, as_simulation: bool) -> anyhow::Result<String> {
async fn _exec(&self, cmd: ProposeCommand, opts: ProposeOptions, as_simulation: bool, print_out_command: bool) -> anyhow::Result<String> {
if let Some(summary) = opts.clone().summary {
let summary_count = summary.chars().count();
if summary_count > MAX_SUMMARY_CHAR_COUNT {
Expand Down Expand Up @@ -147,7 +147,7 @@ impl IcAdminWrapper {
]
.concat()
.as_slice(),
false,
print_out_command,
)
.await
}
Expand All @@ -159,18 +159,18 @@ impl IcAdminWrapper {
async fn propose_run_inner(&self, cmd: ProposeCommand, opts: ProposeOptions, dry_run: bool) -> anyhow::Result<String> {
// Dry run, or --help executions run immediately and do not proceed.
if dry_run || cmd.args().contains(&String::from("--help")) || cmd.args().contains(&String::from("--dry-run")) {
return self._exec(cmd, opts, true).await;
return self._exec(cmd, opts, true, false).await;
}

// If --yes was specified, don't ask the user if they want to proceed
if !self.proceed_without_confirmation {
self._exec(cmd.clone(), opts.clone(), false).await?;
self._exec(cmd.clone(), opts.clone(), true, false).await?;
}

if self.proceed_without_confirmation || Confirm::new().with_prompt("Do you want to continue?").default(false).interact()? {
// User confirmed the desire to submit the proposal and no obvious problems were
// found. Proceeding!
self._exec(cmd, opts, false).await
self._exec(cmd, opts, false, true).await
} else {
Err(anyhow::anyhow!("Action aborted"))
}
Expand Down
Loading