Skip to main content

track/models/
todo_add_options.rs

1/// Options when creating a new TODO.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub struct TodoAddOptions {
4    /// Legacy per-TODO worktree flag (deprecated; use jj-task per task instead).
5    pub worktree_requested: bool,
6    /// When true (default), a jj-task/git workspace is required before execute.
7    pub requires_workspace: bool,
8}
9
10impl Default for TodoAddOptions {
11    fn default() -> Self {
12        Self {
13            worktree_requested: false,
14            requires_workspace: true,
15        }
16    }
17}
18
19impl TodoAddOptions {
20    pub fn from_flags(worktree: bool, no_workspace: bool) -> Self {
21        Self {
22            worktree_requested: worktree,
23            requires_workspace: !no_workspace,
24        }
25    }
26}
27
28impl From<bool> for TodoAddOptions {
29    /// `true` selects legacy `--worktree` (deprecated).
30    fn from(worktree_requested: bool) -> Self {
31        Self::from_flags(worktree_requested, false)
32    }
33}