chore: renames and other housekeeping

This commit is contained in:
Jeremy Wall 2024-12-14 08:09:20 -05:00
parent fa5c2c2d58
commit 76b4d46222
3 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ use slice_utils::{Measured, Peekable, Seekable, Span, StrCursor};
#[derive(Debug, PartialEq, Eq)]
pub enum Cmd<'a> {
Write(Option<&'a str>),
InsertRow(usize),
InsertRows(usize),
InsertColumns(usize),
RenameSheet(Option<usize>, &'a str),
NewSheet(Option<&'a str>),
@ -155,7 +155,7 @@ fn try_consume_insert_row<'cmd, 'i: 'cmd>(
return Err("Invalid command: Did you mean to type `insert-rows <arg>`?");
}
let arg = input.span(0..).trim();
return Ok(Some(Cmd::InsertRow(if arg.is_empty() {
return Ok(Some(Cmd::InsertRows(if arg.is_empty() {
1
} else {
if let Ok(count) = arg.parse() {

View File

@ -425,7 +425,7 @@ impl<'ws> Workspace<'ws> {
self.book.evaluate();
Ok(None)
}
Ok(Some(Cmd::InsertRow(count))) => {
Ok(Some(Cmd::InsertRows(count))) => {
self.book.insert_rows(self.book.location.row, count)?;
self.book.evaluate();
Ok(None)

View File

@ -35,7 +35,7 @@ fn test_insert_rows_cmd() {
let output = result.unwrap();
assert!(output.is_some());
let cmd = output.unwrap();
assert_eq!(cmd, Cmd::InsertRow(1));
assert_eq!(cmd, Cmd::InsertRows(1));
}
#[test]
@ -46,7 +46,7 @@ fn test_insert_rows_cmd_short() {
let output = result.unwrap();
assert!(output.is_some());
let cmd = output.unwrap();
assert_eq!(cmd, Cmd::InsertRow(1));
assert_eq!(cmd, Cmd::InsertRows(1));
}
#[test]