Skip to content

Commit

Permalink
add long_text to add command
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Jun 18, 2024
1 parent ee8abab commit 1e9f813
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ pub struct Add {
#[arg(short, long)]
time: Option<String>,

/// Add a long description
/// Add a long description by opening an editor
#[arg(short, long)]
long: Option<String>,
long: bool,

/// Add a long description as text content
#[arg(long)]
long_text: Option<String>,
}

impl Command for Add {
Expand All @@ -34,9 +38,12 @@ impl Command for Add {
None => now,
};

let long = match self.long {
Some(ref v) => Some(v.clone()),
None => prompt_long()?,
let long = match self.long_text {
Some(ref txt) => Some(txt.clone()),
None => match self.long {
true => prompt_long()?,
false => None,
},
};

store.push_entry(Entry {
Expand Down

0 comments on commit 1e9f813

Please sign in to comment.