pub async fn execute_remove(
args: &ChangesetDeleteArgs,
output: &Output,
root: Option<&Path>,
config_path: Option<&Path>,
) -> Result<()>Expand description
Execute the changeset remove command.
Removes a specified changeset after confirmation, archiving it for recovery. Outputs results in either human-readable formatted view or JSON format.
§Arguments
args- Command arguments including the branch name to remove and force flagoutput- Output handler for formatting and displaying resultsroot- Optional workspace root directory (defaults to current directory)config_path- Optional path to config file (from global--configoption)
§Returns
Returns Ok(()) on success, or an error if the operation fails.
§Errors
Returns an error if:
- The workspace is not initialized (no configuration found)
- The specified changeset does not exist
- User cancels the confirmation prompt
- Archiving fails
- Deletion fails
- File system operations fail
§Examples
ⓘ
use sublime_cli_tools::commands::changeset::execute_remove;
use sublime_cli_tools::cli::commands::ChangesetDeleteArgs;
use sublime_cli_tools::output::{Output, OutputFormat};
use std::io;
// Remove with confirmation
let args = ChangesetDeleteArgs {
branch: "feature/my-feature".to_string(),
force: false,
};
let output = Output::new(OutputFormat::Human, io::stdout(), false);
execute_remove(&args, &output, None, None).await?;
// Force remove without confirmation
let args_force = ChangesetDeleteArgs {
branch: "feature/another-feature".to_string(),
force: true,
};
execute_remove(&args_force, &output, None, None).await?;