History

less verbose gh tool logging in dry-run mode (#198)

Sebastian Thiel committed 5 years ago

Commit 75ebf0b1 parent 552ae4f1 file · +14 −5Browse files

Unified · Split

cargo-smart-release/src/command/release/github.rs+14−5
@@ -38,18 +38,27 @@ pub fn create_release( · 37 unmodified lines
38 let tag_name = crate::utils::tag_name(publishee, new_version, &ctx.repo);38 let tag_name = crate::utils::tag_name(publishee, new_version, &ctx.repo);
39 let mut cmd = Command::new("gh");39 let mut cmd = Command::new("gh");
40 cmd.arg(&tag_name)40 cmd.arg(&tag_name)
41 .arg("--notes")
42 .arg(notes)
43 .arg("--title")41 .arg("--title")
44 .arg(format!("{} v{}", publishee.name, new_version));42 .arg(format!("{} v{}", publishee.name, new_version))
43 .arg("--notes");
45 if dry_run && verbose {44 if dry_run && verbose {
46 log::info!("{} run {:?}", will(dry_run), cmd);45 log::info!(
46 "{} run {:?} \"{}…\" [note truncated]",
47 will(dry_run),
48 cmd,
49 notes.chars().take(33).collect::<String>()
50 );
47 }51 }
52
53 cmd.arg(notes);
48 if !Program::named("gh").found {54 if !Program::named("gh").found {
49 log::warn!("To create github releases, please install the 'gh' program and try again");55 log::warn!("To create github releases, please install the 'gh' program and try again");
50 return Ok(());56 return Ok(());
51 } else if !dry_run && !cmd.status()?.success() {57 } else if !dry_run && !cmd.status()?.success() {
52 log::warn!("'gh' tool execution failed - we will keep trying, and you may try to create the release manually using the command invocation above.");58 log::warn!(
59 "'gh' tool execution failed - we will keep trying, and you may try to create the release with: {:?}",
60 cmd
61 );
53 }62 }
54 Ok(())63 Ok(())
55}64}