Skip to main content

workyard_application/actions/list/
action.rs

1use super::{ListInput, ListOutcome};
2use crate::{contracts::Progress, execution::blocking_action};
3use trine::InvocationContext;
4
5/// List active tasks and recent retirements from workspace state.
6pub async fn list(
7	input: ListInput,
8	context: InvocationContext<Progress>,
9) -> Result<ListOutcome, ListOutcome> {
10	blocking_action(run(input, context)).await
11}
12
13async fn run(
14	input: ListInput,
15	context: InvocationContext<Progress>,
16) -> Result<ListOutcome, ListOutcome> {
17	crate::observation::read(
18		None,
19		input.workspace,
20		crate::observation::Selection::Inventory,
21		context,
22	)
23	.await
24	.map(ListOutcome)
25	.map_err(ListOutcome)
26}