note
Generic note actions: add, show, list, update and delete the notes on a task or an artifact.
fn show
pub async fn show(
context: &AppContext,
raw_note_id: &str,
output: &json::Flags,
) -> Result<(), Error>Display a single note by its ID.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
raw_note_id |
&str | the note’s ID or a unique prefix of it |
output |
&json::Flags | the output mode: normal, --json, --quiet or --raw |
| returns | Result<(), Error> | Ok(()) once the note is printed, or the error from resolving or loading it. |
fn add
pub async fn add<E: HasNotes>(
context: &AppContext,
raw_id: &str,
body: &str,
agent: Option<&str>,
output: &json::Flags,
) -> Result<(), Error>Create a new note on the resolved entity, resolving the author from flags or git identity.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
raw_id |
&str | the parent entity’s ID or a unique prefix of it |
body |
&str | the note text, or - to write it in $EDITOR |
agent |
Option<&str> | the agent’s name, which makes the author an agent; with None, the git or $USER identity is used |
output |
&json::Flags | the output mode: normal, --json, --quiet or --raw |
| returns | Result<(), Error> | Ok(()) once the note is saved and printed, Error::Editor when the body is empty or the editor fails, or the error from resolving the entity or saving the note. |
fn delete
pub async fn delete(
context: &AppContext,
raw_note_id: &str,
yes: bool,
entity_label: &str,
output: &json::Flags,
) -> Result<(), Error>Confirm and delete the resolved note within a recorded transaction.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
raw_note_id |
&str | the note’s ID or a unique prefix of it |
yes |
bool | skip the confirmation prompt |
entity_label |
&str | the parent’s kind, such as task, used in the prompt and the transaction label |
output |
&json::Flags | the output mode: normal, --json, --quiet or --raw |
| returns | Result<(), Error> | Ok(()) when the note is deleted or the user declines the prompt, or the error that stopped it. |
fn list
pub async fn list<E: HasNotes>(
context: &AppContext,
raw_id: &str,
limit: &LimitArgs,
output: &json::Flags,
) -> Result<(), Error>Render notes attached to the resolved entity.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
raw_id |
&str | the parent entity’s ID or a unique prefix of it |
limit |
&LimitArgs | the --limit option, which caps how many notes print |
output |
&json::Flags | the output mode: normal, --json, --quiet or --raw |
| returns | Result<(), Error> | Ok(()) once the notes are printed, through the pager unless --json or --quiet is set, or the error that stopped it. |
fn update
pub async fn update(
context: &AppContext,
raw_note_id: &str,
body: Option<&str>,
entity_label: &str,
output: &json::Flags,
) -> Result<(), Error>Replace the resolved note’s body within a recorded transaction.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
raw_note_id |
&str | the note’s ID or a unique prefix of it |
body |
Option<&str> | the new text; - or None opens the current body in $EDITOR |
entity_label |
&str | the parent’s kind, such as task, used in the transaction label |
output |
&json::Flags | the output mode: normal, --json, --quiet or --raw |
| returns | Result<(), Error> | Ok(()) once the note is saved and printed, Error::Editor when the new body is empty or the editor fails, or the error from resolving or saving the note. |