[+] Docker
This commit is contained in:
+25
-2
@@ -37,7 +37,7 @@ struct ParsedProfileUrl {
|
||||
namespace: String,
|
||||
}
|
||||
|
||||
pub fn run_config_wizard(path: &Path) -> Result<()> {
|
||||
pub fn run_config_wizard(path: &Path) -> Result<ConfigWizardOutcome> {
|
||||
let existing_config = path.exists();
|
||||
let mut config = Config::load_or_default(path)?;
|
||||
let theme = ColorfulTheme::default();
|
||||
@@ -85,7 +85,17 @@ pub fn run_config_wizard(path: &Path) -> Result<()> {
|
||||
style("saved").green().bold(),
|
||||
style(path.display()).cyan()
|
||||
);
|
||||
Ok(())
|
||||
let run_full_sync_now = prompt_run_full_sync_now_styled(&config, &theme)?;
|
||||
Ok(ConfigWizardOutcome {
|
||||
config,
|
||||
run_full_sync_now,
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ConfigWizardOutcome {
|
||||
pub config: Config,
|
||||
pub run_full_sync_now: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
@@ -389,6 +399,19 @@ fn prompt_wizard_action_styled(theme: &ColorfulTheme) -> Result<WizardAction> {
|
||||
})
|
||||
}
|
||||
|
||||
fn prompt_run_full_sync_now_styled(config: &Config, theme: &ColorfulTheme) -> Result<bool> {
|
||||
if config.mirrors.is_empty() {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
println!();
|
||||
Confirm::with_theme(theme)
|
||||
.with_prompt("Run full sync now?")
|
||||
.default(false)
|
||||
.interact()
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
fn edit_sync_group_styled(config: &mut Config, theme: &ColorfulTheme) -> Result<bool> {
|
||||
if config.mirrors.is_empty() {
|
||||
println!("{}", style("No sync groups to edit.").yellow());
|
||||
|
||||
+8
-1
@@ -146,7 +146,14 @@ fn main() -> Result<()> {
|
||||
let config_path = cli.config.unwrap_or_else(default_config_path);
|
||||
|
||||
match cli.command {
|
||||
Command::Config => interactive::run_config_wizard(&config_path),
|
||||
Command::Config => {
|
||||
let outcome = interactive::run_config_wizard(&config_path)?;
|
||||
if outcome.run_full_sync_now {
|
||||
sync_all(&outcome.config, SyncOptions::default())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Command::Sync(command) => {
|
||||
let config = load_config(&config_path)?;
|
||||
sync_all(
|
||||
|
||||
Reference in New Issue
Block a user