summaryrefslogtreecommitdiff
path: root/src/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmds')
-rw-r--r--src/cmds/cmd/sheetedit.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmds/cmd/sheetedit.rs b/src/cmds/cmd/sheetedit.rs
index 85cb616..8e3449e 100644
--- a/src/cmds/cmd/sheetedit.rs
+++ b/src/cmds/cmd/sheetedit.rs
@@ -59,9 +59,13 @@ async fn collect(args: &Arg, ctx: &JVCommandContext) -> Result<Collect, CmdPrepa
(_, Some(stdin_path)) => tokio::fs::read(stdin_path)
.await
.map_err(CmdPrepareError::Io)?,
- (Some(file_path), None) => tokio::fs::read(file_path)
- .await
- .map_err(CmdPrepareError::Io)?,
+ (Some(file_path), None) => match tokio::fs::read(file_path).await {
+ Ok(data) => data,
+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
+ SheetData::empty().as_bytes().to_vec()
+ }
+ Err(e) => return Err(CmdPrepareError::Io(e)),
+ },
(None, None) => return early_cmd_output!(JVNoneOutput => JVNoneOutput),
};
Ok(Collect { data })