create
gest task create: create a new task.struct Command
pub struct CommandCreate a new task.
When stdin is piped, the first markdown heading (# …) is used as the title
and the full input becomes the description. A title can also be given as a
positional argument, in which case stdin (if piped) is used as the description only.
| Field | Type | Description |
|---|---|---|
title |
Option<String> | The task title (extracted from the first # heading when piping stdin). |
assign |
Option<String> | Assign the task to an author by name. |
batch |
bool | Read NDJSON task objects from stdin (one per line). |
description |
Option<String> | The task description (opens $EDITOR if omitted and stdin is a terminal). |
iteration |
Option<String> | Add the task to an iteration (ID or prefix). |
link |
Vec<String> | Link the task to another entity (format: rel:target). Repeatable. |
metadata |
Vec<String> | Set a metadata key=value pair (repeatable; supports dot-paths and scalar inference). |
metadata_json |
Vec<String> | Merge a JSON object into metadata (repeatable; applied after –metadata pairs). |
phase |
Option<u32> | The phase within the iteration (defaults to max existing + 1). Requires --iteration. |
priority |
Option<u8> | The task priority; either 0-4 (lower is higher) or one of critical|high|medium|low|lowest. |
status |
Option<TaskStatus> | The initial task status. |
tag |
Vec<String> | Add a tag to the task. Repeatable; comma-separated values split into multiple tags. |
output |
json::Flags | The output mode: normal, --json, --quiet or --raw. |
Implements FromArgMatches, Args, Debug.
Command::call
pub async fn call(&self, context: &AppContext) -> Result<(), Error>Insert a new task (or a batch from NDJSON stdin), attaching tags, links, and iteration membership.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
| returns | Result<(), Error> | Ok(()) when the command succeeds, or the error that stopped it. |
Command::batch_create
async fn batch_create(
&self,
_context: &AppContext,
project_id: &Id,
conn: &Connection,
) -> Result<(), Error>Create one task for each NDJSON line on stdin, all in one SQL transaction.
| Parameter | Type | Description |
|---|---|---|
_context |
&AppContext | the application context, which this method does not use |
project_id |
&Id | the project that owns the new tasks |
conn |
&Connection | the connection that holds the SQL transaction |
| returns | Result<(), Error> | Ok(()) once every task is created and printed, or the first error; a record that fails rolls back the whole batch. |
Command::resolve_title_and_description
fn resolve_title_and_description(&self) -> Result<(String, String), Error>Find the title and description from the arguments, $EDITOR or piped stdin.
With a title argument, the description comes from --description, then $EDITOR when
stdin is a terminal, then stdin. With no title and piped stdin, the first # heading is the
title and the whole input is the description.
| Parameter | Type | Description |
|---|---|---|
| returns | Result<(String, String), Error> | The title and the description, Error::Argument when there is no title, or Error::Editor when the editor fails. |
struct BatchRecord
struct BatchRecordA single task record in NDJSON batch mode.
| Field | Type | Description |
|---|---|---|
assigned_to |
Option<String> | Author name to assign to the task; resolved via find_or_create. |
description |
Option<String> | Task description body. |
iteration |
Option<String> | Iteration ID or prefix to attach the task to. |
links |
Option<Vec<String>> | Link specs in the form rel:target_id (or just target_id for relates-to). |
metadata |
Option<Value> | Free-form metadata to merge into the task row. |
phase |
Option<u32> | Phase override for the iteration link (auto-increments from max when absent). |
priority |
Option<u8> | Priority score; lower numbers rank first. |
status |
Option<TaskStatus> | Initial lifecycle status. |
tags |
Option<Vec<String>> | Tag labels to attach to the task. |
title |
String | Short human-readable title. |
Implements Debug, Deserialize<'de>.
fn create_batch_records
async fn create_batch_records(
project_id: &Id,
conn: &Connection,
input: &str,
) -> Result<Vec<Model>, Error>Create every task described in the NDJSON input, applying tags, links, and iteration
membership; intended to run inside an explicit SQL transaction wrapper.
| Parameter | Type | Description |
|---|---|---|
project_id |
&Id | the project that owns the new tasks |
conn |
&Connection | the connection that holds the open SQL transaction |
input |
&str | the NDJSON text, one [BatchRecord] for each non-blank line |
| returns | Result<Vec<Model>, Error> | The created tasks in input order, or Error::Argument for a line that is not a valid record. |
fn parse_link_spec
fn parse_link_spec(spec: &str) -> Result<(RelationshipType, String), Error>Parse a link spec in the format rel:target or just target (defaults to relates-to).
| Parameter | Type | Description |
|---|---|---|
spec |
&str | the link spec |
| returns | Result<(RelationshipType, String), Error> | The relationship type and the target ID or prefix, or Error::Argument for an unknown rel. |
fn resolve_entity_table
async fn resolve_entity_table(conn: &Connection, id: &str) -> repo::resolve::TableTry to resolve the table for a target entity ID by checking multiple tables.
| Parameter | Type | Description |
|---|---|---|
conn |
&Connection | the database connection |
id |
&str | the target ID or prefix |
| returns | repo::resolve::Table | The first of tasks, artifacts and iterations where id resolves; tasks when none does. |
fn table_to_entity_type
fn table_to_entity_type(table: repo::resolve::Table) -> EntityTypeMap a table to its EntityType.
| Parameter | Type | Description |
|---|---|---|
table |
repo::resolve::Table | a table that resolve_entity_table returned |
| returns | EntityType | The entity type stored in table; Notes maps to Task, and it panics for Projects and the audit-only tables. |