diff --git a/src/api/mod.rs b/src/api/mod.rs index dd17a0bdc9..c289844940 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -2360,7 +2360,7 @@ impl fmt::Display for Repo { } #[derive(Serialize, Deserialize, Debug, Default)] -pub struct Deploy { +pub struct Deploy<'d> { #[serde(rename = "environment")] pub env: String, pub name: Option, @@ -2369,9 +2369,11 @@ pub struct Deploy { pub started: Option>, #[serde(rename = "dateFinished")] pub finished: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub projects: Option>>, } -impl Deploy { +impl<'d> Deploy<'d> { /// Returns the name of this deploy, defaulting to `"unnamed"`. pub fn name(&self) -> &str { match self.name.as_deref() { diff --git a/src/commands/deploys/new.rs b/src/commands/deploys/new.rs index 0c19089ea7..af4b57bd1e 100644 --- a/src/commands/deploys/new.rs +++ b/src/commands/deploys/new.rs @@ -71,6 +71,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { env: matches.get_one::("env").unwrap().to_string(), name: matches.get_one::("name").cloned(), url: matches.get_one::("url").cloned(), + projects: matches.get_many::("project").map(|x| x.into_iter().map(|x| x.into()).collect()), ..Default::default() }; @@ -90,8 +91,9 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { } let org = config.get_org(matches)?; - let created_deploy = api - .authenticated()? + let authenticated_api = api.authenticated()?; + + let created_deploy = authenticated_api .create_deploy(&org, &version, &deploy)?; println!(