From b796d6e51b83ff9a427f69763f8beb04d0751f7f Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 3 Aug 2026 08:50:21 -0400 Subject: [PATCH] Rename config commands to folder inventory --- README.md | 8 ++++---- src/cli.rs | 20 ++++++++++---------- src/cli/setup.rs | 17 ++++++++++------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4b11c9b..991c82a 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ synchronization. ## Import local folders -`appa config` manages a non-secret local folder inventory. It is useful for +`appa folder` manages a non-secret local folder inventory. It is useful for provisioning or recreating local folder paths and modes. It does not contain invitations, folder IDs, capabilities, membership, or any other shared-folder state. Join shared folders with an invitation instead. @@ -144,7 +144,7 @@ state. Join shared folders with an invitation instead. Write an inventory from your current folders ```sh -appa --offline config template +appa --offline folder template ``` This writes `appa.toml` by default with one `[[folders]]` entry per folder. @@ -154,8 +154,8 @@ Each entry has a `path`, optional `name`, and local `mode`. `mode` is Validate and import ```sh -appa --offline config validate -appa --offline config import +appa --offline folder validate +appa --offline folder import ``` `import` registers new folders and updates the local mode of existing ones. It diff --git a/src/cli.rs b/src/cli.rs index 30d1b45..5cdcb12 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -56,7 +56,7 @@ struct CommandLine { #[arg( long, global = true, - help = "Required for identity and config commands after stopping the daemon; ignored by other commands" + help = "Required for identity and folder inventory commands after stopping the daemon; ignored by other commands" )] offline: bool, #[command(subcommand)] @@ -207,9 +207,9 @@ enum Command { command: ServiceCommand, }, #[command(about = "Export, validate, or import a local folder inventory")] - Config { + Folder { #[command(subcommand)] - command: ConfigCommand, + command: FolderCommand, }, #[command(about = "Check Appa state for common problems")] Doctor { @@ -219,20 +219,20 @@ enum Command { } #[derive(Debug, Subcommand)] -enum ConfigCommand { +enum FolderCommand { #[command(about = "Write a local folder inventory; fails if the file exists")] Template { - #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Configuration path")] + #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Inventory path")] path: PathBuf, }, #[command(about = "Validate a local folder inventory and its paths")] Validate { - #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Configuration path")] + #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Inventory path")] path: PathBuf, }, #[command(about = "Register folders and update local modes from an inventory")] Import { - #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Configuration path")] + #[arg(default_value = DEFAULT_CONFIG_PATH, value_name = "PATH", help = "Inventory path")] path: PathBuf, }, } @@ -291,7 +291,7 @@ pub async fn run() -> anyhow::Result<()> { } async fn run_app_command(command: Command, offline: bool) -> anyhow::Result<()> { - if matches!(command, Command::Identity { .. } | Command::Config { .. }) { + if matches!(command, Command::Identity { .. } | Command::Folder { .. }) { if !offline { anyhow::bail!( "this command changes local state directly; stop the daemon and pass --offline" @@ -377,7 +377,7 @@ async fn run_app_command(command: Command, offline: bool) -> anyhow::Result<()> Command::Doctor { json } => println!("{}", client.doctor(json).await?), Command::Service { .. } => unreachable!("service commands are handled before opening Appa"), Command::Daemon { .. } => unreachable!("daemon commands are handled before opening Appa"), - Command::Identity { .. } | Command::Config { .. } => { + Command::Identity { .. } | Command::Folder { .. } => { unreachable!("offline commands are handled first") } Command::Run { .. } => unreachable!("run is handled before opening Appa"), @@ -389,7 +389,7 @@ async fn run_offline_command(command: Command) -> anyhow::Result<()> { let appa = AppaService::open()?; match command { Command::Identity { command } => setup::run_identity_command(&appa, command)?, - Command::Config { command } => setup::run_config(&appa, command)?, + Command::Folder { command } => setup::run_folder_command(&appa, command)?, _ => unreachable!("only offline commands reach this handler"), } Ok(()) diff --git a/src/cli/setup.rs b/src/cli/setup.rs index 43868d7..8be399f 100644 --- a/src/cli/setup.rs +++ b/src/cli/setup.rs @@ -1,6 +1,6 @@ use crate::{ app::AppaService, - cli::{ConfigCommand, IdentityCommand}, + cli::{FolderCommand, IdentityCommand}, }; const REPLACE_EXISTING_IDENTITY: bool = true; @@ -33,23 +33,26 @@ pub(super) fn run_identity_command( Ok(()) } -pub(super) fn run_config(appa: &AppaService, command: ConfigCommand) -> anyhow::Result<()> { +pub(super) fn run_folder_command( + appa: &AppaService, + command: FolderCommand, +) -> anyhow::Result<()> { match command { - ConfigCommand::Template { path } => { + FolderCommand::Template { path } => { appa.export_folder_inventory(&path)?; println!( - "Wrote {}. Keep capabilities in environment variables, not this file.", + "Wrote local folder inventory to {}.", path.display() ); } - ConfigCommand::Validate { path } => { + FolderCommand::Validate { path } => { appa.validate_folder_inventory(&path)?; println!("{} is valid.", path.display()); } - ConfigCommand::Import { path } => { + FolderCommand::Import { path } => { let folders = appa.import_folder_inventory(&path)?; println!( - "Applied {} folder(s) from {}.", + "Imported {} folder(s) from {}.", folders.len(), path.display() ); -- 2.51.2