diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-22 10:34:24 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-22 10:34:24 +0200 |
commit | dfeb8312ebf34479ccb82faae116ed242d372f86 (patch) | |
tree | e1455c5e1382d9f56ca06cd6455f5f35af8fa1f6 | |
parent | 38b6ded40c6d840c9d3951f0a082cd55b1b0109c (diff) | |
parent | 8f88a07ab48c1592f22db6aeedd5d3c920ea99e3 (diff) |
Merge branch 'release-new-print'
-rw-r--r-- | src/cli.rs | 7 | ||||
-rw-r--r-- | src/commands/release.rs | 14 |
2 files changed, 17 insertions, 4 deletions
@@ -820,6 +820,13 @@ pub fn cli<'a>() -> App<'a> { .about("Dont be interactive (only with --update at the moment)") .requires("package_do_update") ) + .arg(Arg::new("quiet") + .required(false) + .multiple(false) + .long("quiet") + .short('q') + .about("Don't print pathes to released filesfiles after releases are complete") + ) ) ) diff --git a/src/commands/release.rs b/src/commands/release.rs index 2910810..0628d40 100644 --- a/src/commands/release.rs +++ b/src/commands/release.rs @@ -43,6 +43,7 @@ async fn new_release( config: &Configuration, matches: &ArgMatches, ) -> Result<()> { + let print_released_file_pathes = !matches.is_present("quiet"); let release_store_name = matches.value_of("release_store_name").unwrap(); // safe by clap if !(config.releases_directory().exists() && config.releases_directory().is_dir()) { return Err(anyhow!( @@ -163,21 +164,26 @@ async fn new_release( } // else !dest_path.exists() - tokio::fs::copy(art_path, dest_path) + tokio::fs::copy(art_path, &dest_path) .await .map_err(Error::from) - .map(|_| art) + .map(|_| (art, dest_path)) } }) .collect::<futures::stream::FuturesUnordered<_>>() .collect::<Result<Vec<_>>>() .await? .into_iter() - .try_for_each(|art| { + .try_for_each(|(art, dest_path)| { debug!("Updating {:?} to set released = true", art); let rel = crate::db::models::Release::create(&conn, &art, &now, &release_store)?; debug!("Release object = {:?}", rel); - Ok(()) + + if print_released_file_pathes { + writeln!(std::io::stdout(), "{}", dest_path.display()).map_err(Error::from) + } else { + Ok(()) + } }) } |