Skip to content

Commit

Permalink
onboarding: simplify onboarding asks
Browse files Browse the repository at this point in the history
  • Loading branch information
xtexx committed Dec 15, 2024
1 parent 64e568a commit 937756d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/actions/onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn onboarding(custom_tarball: Option<&String>, arch: Option<&str>) -> Result
} else {
ask_for_target_arch()?
};
let config = config::ask_for_config(None)?;
let config = config::ask_for_config()?;
let mut init_instance: Option<String> = None;
if user_attended()
&& Confirm::with_theme(&theme)
Expand Down
16 changes: 4 additions & 12 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,18 @@ fn get_default_editor() -> OsString {
}

/// Shows a series of prompts to let the user select the configurations
pub fn ask_for_config(config: Option<WorkspaceConfig>) -> Result<WorkspaceConfig> {
let mut config = config.unwrap_or_default();
pub fn ask_for_config() -> Result<WorkspaceConfig> {
let mut config = WorkspaceConfig::default();
if !user_attended() {
info!("Not controlled by an user. Default values are used.");
return Ok(config);
}
let theme = ColorfulTheme::default();
config.maintainer = Input::<String>::with_theme(&theme)
.with_prompt("Maintainer Information")
.with_prompt("Maintainer")
.default(config.maintainer)
.validate_with(|s: &String| validate_maintainer(s.as_str()))
.interact_text()?;
config.dnssec = Confirm::with_theme(&theme)
.with_prompt("Enable DNSSEC")
.default(config.dnssec)
.interact()?;
let edit_source = Confirm::with_theme(&theme)
.with_prompt("Edit sources.list")
.default(false)
Expand All @@ -189,13 +185,9 @@ pub fn ask_for_config(config: Option<WorkspaceConfig>) -> Result<WorkspaceConfig
.default(config.local_repo)
.interact()?;
config.sep_mount = Confirm::with_theme(&theme)
.with_prompt("Use different OUTPUT dir for different branches")
.with_prompt("Use different OUTPUT directories for different branches")
.default(config.sep_mount)
.interact()?;
config.volatile_mount = Confirm::with_theme(&theme)
.with_prompt("Use volatile mode for filesystem operations")
.default(config.volatile_mount)
.interact()?;

// FIXME: RISC-V build hosts is unreliable when using oma: random lock-ups
// during `oma refresh'. Disabling oma to workaround potential lock-ups.
Expand Down

0 comments on commit 937756d

Please sign in to comment.