Add board presets, devices --clear, and test/UX fixes

Board presets:
- anvil new --board mega (uno, mega, nano, nano-old, leonardo, micro)
- anvil new --list-boards shows presets with compatible clones
- FQBN and baud rate flow into .anvil.toml via template variables
- Defaults to uno when --board is omitted

Devices --clear:
- anvil devices --clear deletes .anvil.local, reverts to auto-detect
This commit is contained in:
Eric Ratliff
2026-02-19 07:41:12 -06:00
parent d7c6d432f9
commit 2739d83b99
9 changed files with 384 additions and 12 deletions

View File

@@ -274,6 +274,31 @@ pub fn set_port(port: Option<&str>, project_dir: Option<&str>) -> Result<()> {
// -- Helpers --------------------------------------------------------------
/// Delete .anvil.local from the given project directory.
pub fn clear_port(project_dir: Option<&str>) -> Result<()> {
let project_path = resolve_project_dir(project_dir)?;
require_anvil_project(&project_path)?;
let local_file = project_path.join(".anvil.local");
if !local_file.exists() {
println!(
"{} No .anvil.local file found -- nothing to clear.",
"--".bright_black()
);
return Ok(());
}
fs::remove_file(&local_file)
.context("Failed to delete .anvil.local")?;
println!(
"{} Removed .anvil.local -- port will be auto-detected.",
"ok".green()
);
Ok(())
}
fn resolve_project_dir(project_dir: Option<&str>) -> Result<PathBuf> {
match project_dir {
Some(dir) => Ok(PathBuf::from(dir)),