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

feat(dre): Prompt to add a forum post link to a proposal, if it's missing #948

Merged
merged 1 commit into from
Sep 20, 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
25 changes: 25 additions & 0 deletions rs/cli/src/ic_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,31 @@ impl IcAdminImpl {
}

async fn propose_run_inner(&self, cmd: ProposeCommand, opts: ProposeOptions, dry_run: bool) -> anyhow::Result<String> {
let opts = if opts.forum_post_link.is_some() || self.proceed_without_confirmation {
opts
} else {
println!(
"Proposal title: {}",
opts.title.as_deref().unwrap_or(opts.summary.as_deref().unwrap_or(""))
);
let forum_post_link = Confirm::new()
.with_prompt("Link to a forum thread not found. Do you want to add it?")
.default(true)
.interact()?;
if forum_post_link {
let forum_post_link = dialoguer::Input::<String>::new()
.with_prompt("Forum post link")
.allow_empty(true)
.interact()?;
ProposeOptions {
forum_post_link: Some(forum_post_link),
..opts
}
} else {
opts
}
};

// 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, false, false).await;
Expand Down
Loading