Skip to main content

excel_cli/actions/
command.rs

1use super::types::ActionCommand;
2use super::{ActionType, Command};
3
4impl ActionCommand {
5    // Returns the action type of this command
6    #[must_use]
7    pub fn get_action_type(&self) -> ActionType {
8        match self {
9            ActionCommand::Cell(action) => match action.action_type {
10                ActionType::Paste => ActionType::Paste,
11                _ => ActionType::Edit, // Default case including Edit and Cut
12            },
13            ActionCommand::Row(_) => ActionType::DeleteRow,
14            ActionCommand::MultiRow(_) => ActionType::DeleteMultiRows,
15            ActionCommand::Column(_) => ActionType::DeleteColumn,
16            ActionCommand::MultiColumn(_) => ActionType::DeleteMultiColumns,
17            ActionCommand::Sheet(action) => action.action_type(),
18        }
19    }
20}