Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
feat(cli): only fetch the settings a cmd really needs
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleygwilliams committed May 24, 2019
1 parent e25ea8f commit a8b7fff
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,12 @@ fn main() -> Result<(), failure::Error> {
);
commands::generate(name, template, &cache)?;
}
} else if matches.subcommand_matches("whoami").is_some()
|| matches.subcommand_matches("build").is_some()
} else if matches.subcommand_matches("build").is_some()
|| matches.subcommand_matches("preview").is_some()
|| matches.subcommand_matches("publish").is_some()
{
info!("Getting project settings");
let project = settings::project::Project::new()?;

info!("Getting user settings");
let user = settings::global_user::GlobalUser::new()?;

if matches.subcommand_matches("whoami").is_some() {
commands::whoami(&user);
}

if matches.subcommand_matches("build").is_some() {
commands::build(&cache, &project.project_type)?;
}
Expand All @@ -156,11 +147,20 @@ fn main() -> Result<(), failure::Error> {
commands::build(&cache, &project.project_type)?;
commands::preview(method, body)?;
}
} else if matches.subcommand_matches("whoami").is_some() {
info!("Getting User settings");
let user = settings::global_user::GlobalUser::new()?;

if matches.subcommand_matches("publish").is_some() {
commands::build(&cache, &project.project_type)?;
commands::publish(user, project)?;
}
commands::whoami(&user);
} else if matches.subcommand_matches("publish").is_some() {
info!("Getting project settings");
let project = settings::project::Project::new()?;

info!("Getting User settings");
let user = settings::global_user::GlobalUser::new()?;

commands::build(&cache, &project.project_type)?;
commands::publish(user, project)?;
}
Ok(())
}

0 comments on commit a8b7fff

Please sign in to comment.