File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,7 +183,8 @@ async fn run_import(args: ImportArgs) -> anyhow::Result<()> {
183183 }
184184
185185 // Check for existing profile
186- if let Some ( existing) = profile_store:: read_profile ( & args. name ) ? {
186+ let existing = profile_store:: read_profile ( & args. name ) ?;
187+ if let Some ( ref existing) = existing {
187188 eprintln ! (
188189 "Profile \" {}\" already exists (id: {}). Overwriting." ,
189190 args. name, existing. profile_id
@@ -280,8 +281,18 @@ async fn run_import(args: ImportArgs) -> anyhow::Result<()> {
280281
281282 // Upload
282283 println ! ( " Uploading..." ) ;
283- let profile_id =
284- profile_porter:: upload_profile_to_steel ( result. zip_buffer , & api_key, & api_base) . await ?;
284+ let profile_id = if let Some ( ref existing) = existing {
285+ profile_porter:: update_profile_on_steel (
286+ & existing. profile_id ,
287+ result. zip_buffer ,
288+ & api_key,
289+ & api_base,
290+ )
291+ . await ?;
292+ existing. profile_id . clone ( )
293+ } else {
294+ profile_porter:: upload_profile_to_steel ( result. zip_buffer , & api_key, & api_base) . await ?
295+ } ;
285296
286297 // Save metadata
287298 profile_store:: write_profile (
You can’t perform that action at this time.
0 commit comments