task_detail

Single-task detail view composing status, priority, links, tags, and a markdown body section.

const GAP

source

const GAP: &str = "  ";

Spacing between label and value columns.

const INDENT

source

const INDENT: &str = "  ";

Indentation prefix for detail rows.

struct Component

source

pub struct Component<'a>

Renders the full detail view for a single task, including status, priority, links, tags, and optional body.

Field Type Description
assigned Option<&'a str> Assignee for the assigned row; set only in tests, None hides the row.
body Option<&'a str> Markdown description, rendered between description and closing rules; None leaves it out.
id &'a str Full task ID; the header shows its first 8 characters.
id_prefix_len usize Number of highlighted characters in the header ID and in each link ID; 2 by default.
links Vec<(&'a str, &'a str)> (relation, id) pairs for the links rows; set only in tests, empty hides the rows.
phase Option<(u32, Option<&'a str>)> Phase number and optional name for the phase row; set only in tests, None hides the row.
priority Option<u8> Priority shown as P<n> in the priority row; None hides the row.
status &'a str Task status, shown as a status badge.
tags &'a [String] Tag labels for the tags row; the row is hidden when empty.
title &'a str Task title for the title row.

Implements Display.

Component::new

source

pub fn new(id: &'a str, title: &'a str, status: &'a str) -> Self

Create a detail view for a task with the given id, title, and status.

Parameter Type Description
id &'a str the full task ID
title &'a str the task title
status &'a str the task status
returns Self The view, with only the title and status rows and a 2-character ID prefix.

Component::body

source

pub fn body(self, b: Option<&'a str>) -> Self

Sets optional markdown body content to render in a description section.

Parameter Type Description
b Option<&'a str> the markdown description, or None for none
returns Self The view with the body replaced.

Component::id_prefix_len

source

pub fn id_prefix_len(self, len: usize) -> Self

Sets the highlighted prefix length used for the heading and link IDs.

Parameter Type Description
len usize the prefix length
returns Self The view with the new prefix length.

Component::priority

source

pub fn priority(self, p: Option<u8>) -> Self

Sets the task priority level.

Parameter Type Description
p Option<u8> the priority, or None to hide the row
returns Self The view with the priority replaced.

Component::tags

source

pub fn tags(self, t: &'a [String]) -> Self

Sets the tags to display for this task.

Parameter Type Description
t &'a [String] the tag labels, without the #
returns Self The view with the tags replaced.

Component::body_width

source

fn body_width(&self) -> usize

Width available to the markdown body: the terminal width less the indent.

Parameter Type Description
returns usize The width in columns, at least 0.

Component::label

source

fn label(&self, text: &str, width: usize) -> Label

Build a field label in the task.detail.label style.

Parameter Type Description
text &str the label text
width usize the width to pad it to, from label_width
returns Label The padded label.

Component::label_width

source

fn label_width(&self) -> usize

Width of the longest label among the rows this task shows, so the values line up.

Parameter Type Description
returns usize The length of that label; at least 6, for status.

Component::phase_value

source

fn phase_value(&self, number: u32, name: Option<&str>) -> String

Format the phase row value.

Parameter Type Description
number u32 the phase number
name Option<&str> the phase name, if it has one
returns String The number alone, or the number, a muted · and the name.

Component::status_badge

source

fn status_badge(&self) -> StatusBadge<'_>

Build the status row value.

Parameter Type Description
returns StatusBadge<'_> A status badge for the task’s status.