Implement smoother todo editing with the following features: - Display numbered tasks [1], [2], etc. in `streamd todo` - Add `streamd todo N edit` to open editor at task line - Add `streamd todo N done` to insert @Done after @Task - Add `--show-future` flag to include future tasks (hidden by default)
40 lines
1 KiB
Rust
40 lines
1 KiB
Rust
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum StreamdError {
|
|
#[error("Could not extract date from file name: {0}")]
|
|
DateExtractionError(String),
|
|
|
|
#[error("Timesheet error: {0}")]
|
|
TimesheetError(String),
|
|
|
|
#[error("Configuration error: {0}")]
|
|
ConfigError(String),
|
|
|
|
#[error("IO error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
|
|
#[error("TOML error: {0}")]
|
|
TomlError(#[from] toml::de::Error),
|
|
|
|
#[error("Invalid task number {0}: only {1} tasks available")]
|
|
InvalidTaskNumber(usize, usize),
|
|
|
|
#[error("Task shard missing file path")]
|
|
MissingFilePath,
|
|
|
|
#[error("Invalid line number in task")]
|
|
InvalidLineNumber,
|
|
|
|
#[error("Multiple @Task markers found in {0}:{1} - cannot auto-insert @Done")]
|
|
MultipleTaskMarkers(String, usize),
|
|
|
|
#[error("No @Task marker found in {0}:{1}")]
|
|
NoTaskMarker(String, usize),
|
|
}
|
|
|
|
impl From<StreamdError> for miette::Report {
|
|
fn from(err: StreamdError) -> Self {
|
|
miette::Report::msg(err.to_string())
|
|
}
|
|
}
|