Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2503f9aee9 | ||
|
|
ddbd45e332 | ||
|
|
b7781a830c | ||
|
|
3abe8755c8 | ||
|
|
b6d0b55d4b | ||
|
|
3fcb0ddc0a | ||
|
|
8563218ab5 | ||
|
|
54569b2c85 |
@@ -37,6 +37,7 @@ Add a new ticket to the backlog.
|
|||||||
- `--tags` (or `-g`): Tags (comma-separated)
|
- `--tags` (or `-g`): Tags (comma-separated)
|
||||||
- `--due` (or `--due`): Due date in YYYY-MM-DD format
|
- `--due` (or `--due`): Due date in YYYY-MM-DD format
|
||||||
- `--owner` (or `-o`): Owner name
|
- `--owner` (or `-o`): Owner name
|
||||||
|
- `--priority`: Priority level, 1 (most urgent) to 5 (least). Unset if omitted
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
worklane add -t "Implement login" -d "Add user login page" -t login,auth -p "Design UI" "Build backend" "Write tests" --due 2026-06-01 --owner "ilya"
|
worklane add -t "Implement login" -d "Add user login page" -t login,auth -p "Design UI" "Build backend" "Write tests" --due 2026-06-01 --owner "ilya"
|
||||||
@@ -56,11 +57,15 @@ List tickets, optionally filtered by status.
|
|||||||
**Valid statuses:** `backlog`, `committed`, `reviewing`, `done`
|
**Valid statuses:** `backlog`, `committed`, `reviewing`, `done`
|
||||||
|
|
||||||
```
|
```
|
||||||
worklane ls # List all tickets
|
worklane ls # List all tickets
|
||||||
worklane ls backlog # List tickets in backlog
|
worklane ls backlog # List tickets in backlog
|
||||||
worklane ls done # List completed tickets
|
worklane ls done # List completed tickets
|
||||||
|
worklane ls --priority 1 # Only the most urgent, any status
|
||||||
|
worklane ls backlog --priority 2 # Composes with the status filter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Tickets are listed priority first, then by title. Tickets with no priority sort last.
|
||||||
|
|
||||||
### `worklane show`
|
### `worklane show`
|
||||||
|
|
||||||
Show the full details of a single ticket by UUID or title.
|
Show the full details of a single ticket by UUID or title.
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ export const add = tool({
|
|||||||
owner: tool.schema
|
owner: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Ticket owner name. If omitted, defaults to the git user."),
|
.describe("Ticket owner name. If omitted, defaults to the git user."),
|
||||||
|
priority: tool.schema
|
||||||
|
.string()
|
||||||
|
.describe("Priority level, 1 (most urgent) to 5 (least). Left unset if omitted.")
|
||||||
|
.optional(),
|
||||||
},
|
},
|
||||||
async execute(args: Record<string, any>, context: ToolContext) {
|
async execute(args: Record<string, any>, context: ToolContext) {
|
||||||
if (!args.title) {
|
if (!args.title) {
|
||||||
@@ -109,6 +113,7 @@ export const add = tool({
|
|||||||
if (args.tags) cmd.push("--tags", args.tags);
|
if (args.tags) cmd.push("--tags", args.tags);
|
||||||
if (args.due) cmd.push("--due", args.due);
|
if (args.due) cmd.push("--due", args.due);
|
||||||
if (args.owner) cmd.push("--owner", args.owner);
|
if (args.owner) cmd.push("--owner", args.owner);
|
||||||
|
if (args.priority) cmd.push("--priority", String(args.priority));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await run(cmd, context);
|
return await run(cmd, context);
|
||||||
@@ -120,15 +125,20 @@ export const add = tool({
|
|||||||
|
|
||||||
export const ls = tool({
|
export const ls = tool({
|
||||||
description:
|
description:
|
||||||
"List all worklane tickets. Optionally filter by status (backlog, committed, reviewing, done).",
|
"List all worklane tickets, sorted by priority then title. Optionally filter by status and by priority.",
|
||||||
args: {
|
args: {
|
||||||
status: tool.schema
|
status: tool.schema
|
||||||
.enum(["backlog", "committed", "reviewing", "done"])
|
.enum(["backlog", "committed", "reviewing", "done"])
|
||||||
.describe("Filter by status")
|
.describe("Filter by status")
|
||||||
.optional(),
|
.optional(),
|
||||||
|
priority: tool.schema
|
||||||
|
.string()
|
||||||
|
.describe("Only show tickets at this priority, 1 (most urgent) to 5 (least)")
|
||||||
|
.optional(),
|
||||||
},
|
},
|
||||||
async execute(args: Record<string, any>, context: ToolContext) {
|
async execute(args: Record<string, any>, context: ToolContext) {
|
||||||
const cmd = args.status ? ["ls", args.status] : ["ls"];
|
const cmd = args.status ? ["ls", args.status] : ["ls"];
|
||||||
|
if (args.priority) cmd.push("--priority", String(args.priority));
|
||||||
try {
|
try {
|
||||||
return await run(cmd, context);
|
return await run(cmd, context);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## Ticket File Format
|
## Ticket File Format
|
||||||
- Filenames: `<uuid_v4>_<slug>.md`
|
- Filenames: `<uuid_v4>_<slug>.md`
|
||||||
- Metadata fields parsed by `parse_ticket_field()`: `ID`, `Tags`, `Due`, `Owner`, `Created At`, `Status`
|
- Metadata fields parsed by `parse_ticket_field()`: `ID`, `Priority`, `Tags`, `Due`, `Owner`, `Created At`, `Status`
|
||||||
- Format: `**Field Name**: value`
|
- Format: `**Field Name**: value`
|
||||||
- Ticket structure: `# Title` → `## Description` → `## Acceptance Criteria` → `## Implementation Plan` → `## Metadata`
|
- Ticket structure: `# Title` → `## Description` → `## Acceptance Criteria` → `## Implementation Plan` → `## Metadata`
|
||||||
- Comments stored in `.worklane/comments/<ticket_uuid>/<timestamp>.md` with `**Comment**`, `**Author**`, `**Time**` fields
|
- Comments stored in `.worklane/comments/<ticket_uuid>/<timestamp>.md` with `**Comment**`, `**Author**`, `**Time**` fields
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
### Color and Output
|
### Color and Output
|
||||||
- Use `color_text()` helper for colored output — it respects `should_use_colors()` (terminal detection)
|
- Use `color_text()` helper for colored output — it respects `should_use_colors()` (terminal detection)
|
||||||
- Color codes are defined in `get_color()`: red (31), cyan (36), orange (33), green (32), grey (90)
|
- Color codes are defined in `get_color()`: red (31), cyan (36), orange (33), green (32), grey (38;5;8), magenta (1;35), brightred (38;5;9)
|
||||||
- Reset color with `\x1b[0m` after colored text
|
- Reset color with `\x1b[0m` after colored text
|
||||||
- Bold uses `\x1b[1;35m` (magenta bold)
|
- Bold uses `\x1b[1;35m` (magenta bold)
|
||||||
- Always test color output works correctly in both terminal and pipe modes
|
- Always test color output works correctly in both terminal and pipe modes
|
||||||
@@ -43,7 +43,9 @@
|
|||||||
- Status → orange (33)
|
- Status → orange (33)
|
||||||
- Timestamp → cyan (36)
|
- Timestamp → cyan (36)
|
||||||
- Title → green (32)
|
- Title → green (32)
|
||||||
- Unknown values (`_None_`, `_Not set_`) → grey (90)
|
- Unknown values (`_None_`, `_Not set_`) → grey (38;5;8)
|
||||||
|
- Priority ramp → brightred (1), red (2), orange (3), cyan (4), grey (5). Green is deliberately absent: it means title
|
||||||
|
- Grey is indexed colour 8 in the 256-colour form, not SGR 90 or 37. Both of those failed on a real palette: 90 leans on the bright-black slot and 37 can sit on top of the default foreground. `\x1b[38;5;8m` is byte for byte what crossterm emits for ratatui's `Color::DarkGray`, the grey frig and pantop use for dimmed rows
|
||||||
|
|
||||||
### Code Organization
|
### Code Organization
|
||||||
- Colorization functions (`colorize_line`, `colorize_metadata`, `colorize_ordered`, `content_trim_colored`) handle markdown formatting
|
- Colorization functions (`colorize_line`, `colorize_metadata`, `colorize_ordered`, `content_trim_colored`) handle markdown formatting
|
||||||
@@ -60,3 +62,14 @@
|
|||||||
- Commit format: `([ticketID]) [short description]`
|
- Commit format: `([ticketID]) [short description]`
|
||||||
- Use `--fixup` for incremental changes
|
- Use `--fixup` for incremental changes
|
||||||
- Test before moving to reviewing status
|
- Test before moving to reviewing status
|
||||||
|
|
||||||
|
### Version Bumps
|
||||||
|
- Before every commit, decide whether the change warrants a version bump in `Cargo.toml`
|
||||||
|
- Always ask the user to confirm the bump and its kind before making it — never bump silently, and never skip the question because the answer looks obvious
|
||||||
|
- Pre-1.0, so: patch for fixes and internal changes, minor for a new command, flag or changed output, major only for a deliberate 1.0
|
||||||
|
- No bump for docs-only, tests-only or `--fixup` commits
|
||||||
|
- When one body of work spans several commits, bump once on the final commit rather than on each
|
||||||
|
- Bump `Cargo.toml` and the `worklane` entry in `Cargo.lock` together, in the commit that carries the bump
|
||||||
|
- Every bump gets a matching annotated tag, `v<version>`, on the bump commit — a bumped version is never left untagged
|
||||||
|
- Tag locally only; never push a tag unless asked
|
||||||
|
- `worklane --version` reports the crate version alongside the build sha, so the bump is what makes one release distinguishable from another
|
||||||
|
|||||||
Generated
+1
-1
@@ -1029,7 +1029,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "worklane"
|
name = "worklane"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "worklane"
|
name = "worklane"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Worklane is a local Kanban flow for agentic software development.
|
|||||||
| Command | Description |
|
| Command | Description |
|
||||||
|---------|-------------|
|
|---------|-------------|
|
||||||
| `worklane init` | Creates `.worklane/` with backlog, committed, reviewing, done directories |
|
| `worklane init` | Creates `.worklane/` with backlog, committed, reviewing, done directories |
|
||||||
| `worklane add` | Creates a ticket in backlog with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--owner` flags |
|
| `worklane add` | Creates a ticket in backlog with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--owner`, `--priority` flags |
|
||||||
| `worklane ls` | Lists tickets, optionally filtered by `--status` |
|
| `worklane ls [status]` | Lists tickets, sorted by priority then title. Optional positional status, and `--priority <1-5>` |
|
||||||
| `worklane show <id>` | Shows ticket by UUID prefix (8+ chars) or title substring |
|
| `worklane show <id>` | Shows ticket by UUID prefix (8+ chars) or title substring |
|
||||||
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions |
|
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions |
|
||||||
| `worklane comment <ticket> <body>` | Adds a comment to a ticket by UUID or title |
|
| `worklane comment <ticket> <body>` | Adds a comment to a ticket by UUID or title |
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
|
use crate::util::{PRIORITY_RANGE, priority_legend};
|
||||||
|
|
||||||
|
/// clap wants a `&str` with a long enough lifetime, and the legend is built from
|
||||||
|
/// the same ramp the listing uses rather than spelled out a second time.
|
||||||
|
static PRIORITY_LEGEND: LazyLock<String> = LazyLock::new(priority_legend);
|
||||||
|
|
||||||
|
/// Reject a level outside the range at parse time, so no command has to.
|
||||||
|
fn priority_level(raw: &str) -> Result<u8, String> {
|
||||||
|
match raw.parse::<u8>() {
|
||||||
|
Ok(level) if PRIORITY_RANGE.contains(&level) => Ok(level),
|
||||||
|
_ => Err(format!(
|
||||||
|
"priority must be a whole number from {} to {}",
|
||||||
|
PRIORITY_RANGE.start(),
|
||||||
|
PRIORITY_RANGE.end()
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// What `--version` prints: the crate version and the commit it was built from.
|
/// What `--version` prints: the crate version and the commit it was built from.
|
||||||
///
|
///
|
||||||
/// The sha is the part that matters. Two binaries built weeks apart both call
|
/// The sha is the part that matters. Two binaries built weeks apart both call
|
||||||
@@ -51,12 +71,21 @@ pub enum Command {
|
|||||||
/// Owner
|
/// Owner
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
owner: Option<String>,
|
owner: Option<String>,
|
||||||
|
|
||||||
|
/// Priority, 1 (most urgent) to 5 (least). Left unset if omitted.
|
||||||
|
#[arg(long, value_parser = priority_level)]
|
||||||
|
priority: Option<u8>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// List tickets, optionally filtered by status
|
/// List tickets, optionally filtered by status
|
||||||
|
#[command(after_help = PRIORITY_LEGEND.as_str())]
|
||||||
Ls {
|
Ls {
|
||||||
/// Filter by status (backlog, committed, reviewing, done)
|
/// Filter by status (backlog, committed, reviewing, done)
|
||||||
status: Option<String>,
|
status: Option<String>,
|
||||||
|
|
||||||
|
/// Only show tickets at this priority, 1 (most urgent) to 5 (least)
|
||||||
|
#[arg(long, value_parser = priority_level)]
|
||||||
|
priority: Option<u8>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Show a ticket by UUID or title
|
/// Show a ticket by UUID or title
|
||||||
|
|||||||
+96
-9
@@ -1,6 +1,7 @@
|
|||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::util::*;
|
use crate::util::*;
|
||||||
@@ -28,7 +29,11 @@ pub fn cmd_init(start: &Path) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()> {
|
pub fn cmd_ls(
|
||||||
|
status_filter: &Option<String>,
|
||||||
|
priority_filter: Option<u8>,
|
||||||
|
worklane_dir: &Path,
|
||||||
|
) -> Result<()> {
|
||||||
if let Some(status) = status_filter {
|
if let Some(status) = status_filter {
|
||||||
let status_path = worklane_dir.join(status);
|
let status_path = worklane_dir.join(status);
|
||||||
if !status_path.exists() {
|
if !status_path.exists() {
|
||||||
@@ -38,7 +43,7 @@ pub fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let items = collect_ticket_items(&status_path)?;
|
let items = filter_by_priority(collect_ticket_items(&status_path)?, priority_filter);
|
||||||
|
|
||||||
if items.is_empty() {
|
if items.is_empty() {
|
||||||
println!("No tickets in '{}' status.", status);
|
println!("No tickets in '{}' status.", status);
|
||||||
@@ -56,8 +61,8 @@ pub fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()>
|
|||||||
if !status_path.exists() {
|
if !status_path.exists() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let entries: Vec<_> = fs::read_dir(&status_path)?.filter_map(|e| e.ok()).collect();
|
let items = filter_by_priority(collect_ticket_items(&status_path)?, priority_filter);
|
||||||
let count = entries.len();
|
let count = items.len();
|
||||||
let label = if count == 1 { "ticket" } else { "tickets" };
|
let label = if count == 1 { "ticket" } else { "tickets" };
|
||||||
println!(" [{}] {} {}", status.to_uppercase(), count, label);
|
println!(" [{}] {} {}", status.to_uppercase(), count, label);
|
||||||
}
|
}
|
||||||
@@ -72,7 +77,7 @@ pub fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let items = match collect_ticket_items(&status_path) {
|
let items = match collect_ticket_items(&status_path) {
|
||||||
Ok(items) => items,
|
Ok(items) => filter_by_priority(items, priority_filter),
|
||||||
Err(_) => continue,
|
Err(_) => continue,
|
||||||
};
|
};
|
||||||
if items.is_empty() {
|
if items.is_empty() {
|
||||||
@@ -87,6 +92,17 @@ pub fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Keep only the tickets at `level`, or everything when no level was asked for.
|
||||||
|
fn filter_by_priority(items: Vec<TicketItem>, level: Option<u8>) -> Vec<TicketItem> {
|
||||||
|
match level {
|
||||||
|
Some(level) => items
|
||||||
|
.into_iter()
|
||||||
|
.filter(|item| item.priority == Priority::Level(level))
|
||||||
|
.collect(),
|
||||||
|
None => items,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn cmd_add(
|
pub fn cmd_add(
|
||||||
title: &str,
|
title: &str,
|
||||||
description: &[String],
|
description: &[String],
|
||||||
@@ -95,6 +111,7 @@ pub fn cmd_add(
|
|||||||
tags: &[String],
|
tags: &[String],
|
||||||
due: &Option<String>,
|
due: &Option<String>,
|
||||||
owner: &Option<String>,
|
owner: &Option<String>,
|
||||||
|
priority: Option<u8>,
|
||||||
start: &Path,
|
start: &Path,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let owner = match owner {
|
let owner = match owner {
|
||||||
@@ -140,6 +157,7 @@ pub fn cmd_add(
|
|||||||
## Metadata\n\
|
## Metadata\n\
|
||||||
\n\
|
\n\
|
||||||
- **ID**: {}\n\
|
- **ID**: {}\n\
|
||||||
|
- **Priority**: {}\n\
|
||||||
- **Tags**: {}\n\
|
- **Tags**: {}\n\
|
||||||
- **Due**: {}\n\
|
- **Due**: {}\n\
|
||||||
- **Owner**: {}\n\
|
- **Owner**: {}\n\
|
||||||
@@ -167,6 +185,10 @@ pub fn cmd_add(
|
|||||||
.join("\n")
|
.join("\n")
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
|
match priority {
|
||||||
|
Some(level) => level.to_string(),
|
||||||
|
None => "_Not set_".to_string(),
|
||||||
|
},
|
||||||
if tags.is_empty() {
|
if tags.is_empty() {
|
||||||
"_None_".to_string()
|
"_None_".to_string()
|
||||||
} else {
|
} else {
|
||||||
@@ -234,6 +256,40 @@ fn read_comments(comments_dir: &Path) -> Result<Vec<(String, String, String, Str
|
|||||||
Ok(comments)
|
Ok(comments)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Write a comment under the first free name derived from `stem`.
|
||||||
|
///
|
||||||
|
/// `create_new` rather than `fs::write`: a name that already exists means another
|
||||||
|
/// comment landed in the same microsecond, and truncating it is exactly the data
|
||||||
|
/// loss this guards against. The suffix is zero padded so the names keep sorting
|
||||||
|
/// in the order they were written.
|
||||||
|
fn write_new_comment(comments_dir: &Path, stem: &str, content: &str) -> Result<String> {
|
||||||
|
for attempt in 0..100 {
|
||||||
|
let filename = match attempt {
|
||||||
|
0 => format!("{}.md", stem),
|
||||||
|
n => format!("{}_{:02}.md", stem, n),
|
||||||
|
};
|
||||||
|
|
||||||
|
match fs::OpenOptions::new()
|
||||||
|
.write(true)
|
||||||
|
.create_new(true)
|
||||||
|
.open(comments_dir.join(&filename))
|
||||||
|
{
|
||||||
|
Ok(mut file) => {
|
||||||
|
file.write_all(content.as_bytes())?;
|
||||||
|
return Ok(filename);
|
||||||
|
}
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => continue,
|
||||||
|
Err(e) => return Err(e.into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Err(anyhow!(
|
||||||
|
"No free comment filename for '{}' in {}",
|
||||||
|
stem,
|
||||||
|
comments_dir.display()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn cmd_show(search: &str, worklane_dir: &Path) -> Result<()> {
|
pub fn cmd_show(search: &str, worklane_dir: &Path) -> Result<()> {
|
||||||
let (_status, title, content) = resolve_ticket(search, worklane_dir)?;
|
let (_status, title, content) = resolve_ticket(search, worklane_dir)?;
|
||||||
let ticket_uuid = parse_ticket_field(&content, "ID");
|
let ticket_uuid = parse_ticket_field(&content, "ID");
|
||||||
@@ -351,6 +407,39 @@ pub fn cmd_mv(ticket_id: &str, target_status: &str, force: bool, start: &Path) -
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
/// The collision path cannot be provoked from the CLI, since two processes
|
||||||
|
/// will not share a microsecond, but it is the whole point of the guard.
|
||||||
|
#[test]
|
||||||
|
fn a_colliding_stem_takes_the_next_name_and_keeps_the_first() {
|
||||||
|
let dir = std::env::temp_dir().join(format!("worklane-test-{}", uuid::Uuid::new_v4()));
|
||||||
|
fs::create_dir_all(&dir).unwrap();
|
||||||
|
|
||||||
|
let first = write_new_comment(&dir, "20260820_143012_123456", "first").unwrap();
|
||||||
|
let second = write_new_comment(&dir, "20260820_143012_123456", "second").unwrap();
|
||||||
|
let third = write_new_comment(&dir, "20260820_143012_123456", "third").unwrap();
|
||||||
|
|
||||||
|
assert_eq!(first, "20260820_143012_123456.md");
|
||||||
|
assert_eq!(second, "20260820_143012_123456_01.md");
|
||||||
|
assert_eq!(third, "20260820_143012_123456_02.md");
|
||||||
|
|
||||||
|
// Nothing was truncated on the way through
|
||||||
|
assert_eq!(fs::read_to_string(dir.join(&first)).unwrap(), "first");
|
||||||
|
assert_eq!(fs::read_to_string(dir.join(&second)).unwrap(), "second");
|
||||||
|
assert_eq!(fs::read_to_string(dir.join(&third)).unwrap(), "third");
|
||||||
|
|
||||||
|
// read_comments sorts on the stem, so the names must sort in write order
|
||||||
|
let mut names = vec![second.clone(), third.clone(), first.clone()];
|
||||||
|
names.sort();
|
||||||
|
assert_eq!(names, vec![first, second, third]);
|
||||||
|
|
||||||
|
fs::remove_dir_all(&dir).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn cmd_comment(
|
pub fn cmd_comment(
|
||||||
ticket_id: &str,
|
ticket_id: &str,
|
||||||
body: &str,
|
body: &str,
|
||||||
@@ -372,9 +461,7 @@ pub fn cmd_comment(
|
|||||||
let comments_dir = worklane_dir.join("comments").join(&ticket_uuid);
|
let comments_dir = worklane_dir.join("comments").join(&ticket_uuid);
|
||||||
fs::create_dir_all(&comments_dir)?;
|
fs::create_dir_all(&comments_dir)?;
|
||||||
|
|
||||||
let timestamp = Local::now().format("%Y%m%d_%H%M%S");
|
let stem = Local::now().format(COMMENT_FILE_FORMAT).to_string();
|
||||||
let filename = format!("{}.md", timestamp);
|
|
||||||
let filepath = comments_dir.join(&filename);
|
|
||||||
|
|
||||||
let author = match owner {
|
let author = match owner {
|
||||||
Some(o) => o.clone(),
|
Some(o) => o.clone(),
|
||||||
@@ -393,7 +480,7 @@ pub fn cmd_comment(
|
|||||||
Local::now().format(TIMESTAMP_FORMAT)
|
Local::now().format(TIMESTAMP_FORMAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
fs::write(&filepath, comment_content)?;
|
let filename = write_new_comment(&comments_dir, &stem, &comment_content)?;
|
||||||
|
|
||||||
println!("Comment added to '{}' ({})", title, filename);
|
println!("Comment added to '{}' ({})", title, filename);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
+4
-2
@@ -24,6 +24,7 @@ fn main() -> Result<()> {
|
|||||||
tags,
|
tags,
|
||||||
due,
|
due,
|
||||||
owner,
|
owner,
|
||||||
|
priority,
|
||||||
} => cmd_add(
|
} => cmd_add(
|
||||||
&title,
|
&title,
|
||||||
&description,
|
&description,
|
||||||
@@ -32,11 +33,12 @@ fn main() -> Result<()> {
|
|||||||
&tags,
|
&tags,
|
||||||
&due,
|
&due,
|
||||||
&owner,
|
&owner,
|
||||||
|
priority,
|
||||||
&start,
|
&start,
|
||||||
),
|
),
|
||||||
Command::Ls { status } => {
|
Command::Ls { status, priority } => {
|
||||||
let worklane_dir = find_worklane_dir(&start)?;
|
let worklane_dir = find_worklane_dir(&start)?;
|
||||||
cmd_ls(&status, &worklane_dir)
|
cmd_ls(&status, priority, &worklane_dir)
|
||||||
}
|
}
|
||||||
Command::Show { id } => {
|
Command::Show { id } => {
|
||||||
let worklane_dir = find_worklane_dir(&start)?;
|
let worklane_dir = find_worklane_dir(&start)?;
|
||||||
|
|||||||
+479
-40
@@ -3,13 +3,53 @@ use chrono::NaiveDateTime;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::IsTerminal;
|
use std::io::IsTerminal;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
/// How timestamps are written into tickets and comments, and therefore how they
|
/// How timestamps are written into tickets and comments, and therefore how they
|
||||||
/// are read back. Shared so the writer and the reader cannot drift apart.
|
/// are read back. Shared so the writer and the reader cannot drift apart.
|
||||||
pub const TIMESTAMP_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
|
pub const TIMESTAMP_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
|
||||||
|
|
||||||
|
/// How a comment filename is stamped.
|
||||||
|
///
|
||||||
|
/// Microseconds, not seconds: at second resolution two comments in the same
|
||||||
|
/// second produced the same name and the second silently truncated the first.
|
||||||
|
/// Fixed width, so the lexicographic sort in `read_comments` stays chronological.
|
||||||
|
pub const COMMENT_FILE_FORMAT: &str = "%Y%m%d_%H%M%S_%6f";
|
||||||
|
|
||||||
|
/// Whether colour is wanted, from the three inputs that decide it.
|
||||||
|
///
|
||||||
|
/// Split out from the caching wrapper so it can be tested without a pty and
|
||||||
|
/// without touching the process environment.
|
||||||
|
///
|
||||||
|
/// `NO_COLOR` follows the no-color.org convention: set and non-empty disables,
|
||||||
|
/// whatever the value. An empty value is treated as unset, which is what lets a
|
||||||
|
/// wrapper script clear an inherited one.
|
||||||
|
fn colors_wanted(is_terminal: bool, no_color: Option<&str>, term: Option<&str>) -> bool {
|
||||||
|
if no_color.is_some_and(|value| !value.is_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if matches!(term, Some("dumb") | Some("")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_terminal
|
||||||
|
}
|
||||||
|
|
||||||
pub fn should_use_colors() -> bool {
|
pub fn should_use_colors() -> bool {
|
||||||
std::io::stdout().is_terminal()
|
// Decided once: it cannot change mid-run, and color_text asks on every call.
|
||||||
|
static ENABLED: OnceLock<bool> = OnceLock::new();
|
||||||
|
|
||||||
|
*ENABLED.get_or_init(|| {
|
||||||
|
let no_color = std::env::var("NO_COLOR").ok();
|
||||||
|
let term = std::env::var("TERM").ok();
|
||||||
|
|
||||||
|
colors_wanted(
|
||||||
|
std::io::stdout().is_terminal(),
|
||||||
|
no_color.as_deref(),
|
||||||
|
term.as_deref(),
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_color(color: &str) -> &'static str {
|
pub fn get_color(color: &str) -> &'static str {
|
||||||
@@ -18,7 +58,17 @@ pub fn get_color(color: &str) -> &'static str {
|
|||||||
"cyan" => "\x1b[36m",
|
"cyan" => "\x1b[36m",
|
||||||
"orange" => "\x1b[33m",
|
"orange" => "\x1b[33m",
|
||||||
"green" => "\x1b[32m",
|
"green" => "\x1b[32m",
|
||||||
"grey" => "\x1b[90m",
|
// Indexed colour 8 in the 256-colour form, which is byte for byte what
|
||||||
|
// crossterm emits for ratatui's Color::DarkGray, the grey frig and pantop
|
||||||
|
// use for dimmed rows. Neither SGR 90 nor 37 renders as grey on every
|
||||||
|
// palette: 90 leans on the bright-black slot and 37 can sit right on top
|
||||||
|
// of the default foreground.
|
||||||
|
"grey" => "\x1b[38;5;8m",
|
||||||
|
// Bold, per the guideline in AGENTS.md. Its absence meant colorize_line
|
||||||
|
// asked for a colour that did not exist and got an empty prefix.
|
||||||
|
"magenta" => "\x1b[1;35m",
|
||||||
|
// Indexed, for the same reason grey is: this is the spelling that renders.
|
||||||
|
"brightred" => "\x1b[38;5;9m",
|
||||||
_ => "",
|
_ => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,6 +351,21 @@ pub fn colorize_metadata(line: &str) -> String {
|
|||||||
return line.to_string();
|
return line.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Priority reads as a glyph here too, while the file keeps storing the number.
|
||||||
|
if let Some(value) = line.split("**Priority**:").nth(1) {
|
||||||
|
let priority = match value.trim().parse::<u8>() {
|
||||||
|
Ok(level) if PRIORITY_RANGE.contains(&level) => Priority::Level(level),
|
||||||
|
_ if is_unknown_value(value.trim()) => Priority::Unset,
|
||||||
|
_ => Priority::Invalid,
|
||||||
|
};
|
||||||
|
return format!(
|
||||||
|
"- {}: {} {}",
|
||||||
|
color_text("Priority", "red"),
|
||||||
|
show_priority(priority),
|
||||||
|
value.trim()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let content = line;
|
let content = line;
|
||||||
let open_pos = match content.find("**") {
|
let open_pos = match content.find("**") {
|
||||||
Some(p) => p,
|
Some(p) => p,
|
||||||
@@ -339,37 +404,53 @@ pub fn is_unknown_value(value: &str) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn colorize_line(line: &str) -> String {
|
pub fn colorize_line(line: &str) -> String {
|
||||||
let mut result = String::new();
|
colorize_bold(line, should_use_colors())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replace `**bold**` with colour, or leave the line exactly as it is.
|
||||||
|
///
|
||||||
|
/// Taking `enabled` rather than asking makes both paths testable, and the
|
||||||
|
/// disabled path matters: stripping the markers when there is no colour to
|
||||||
|
/// replace them with loses the emphasis altogether, which is what happens to
|
||||||
|
/// every piped `show` and to everything the opencode tools read.
|
||||||
|
fn colorize_bold(line: &str, enabled: bool) -> String {
|
||||||
|
if !enabled {
|
||||||
|
return line.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
let chars: Vec<char> = line.chars().collect();
|
let chars: Vec<char> = line.chars().collect();
|
||||||
let len = chars.len();
|
let mut result = String::new();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
||||||
while i < len {
|
while i < chars.len() {
|
||||||
// Check for **bold** markdown
|
if !is_delimiter(&chars, i) {
|
||||||
if i + 1 < len && chars[i] == '*' && chars[i + 1] == '*' {
|
result.push(chars[i]);
|
||||||
// Find closing **
|
i += 1;
|
||||||
let start = i + 2;
|
|
||||||
let mut end = start;
|
|
||||||
while end + 1 < len && !(chars[end] == '*' && chars[end + 1] == '*') {
|
|
||||||
if chars[end] == '\n' {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
end += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let bold_text: String = chars[start..end].iter().collect();
|
|
||||||
result.push_str(&color_text(&bold_text, "magenta"));
|
|
||||||
i = end + 2;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push(chars[i]);
|
match (i + 2..chars.len()).find(|&at| is_delimiter(&chars, at)) {
|
||||||
i += 1;
|
Some(close) => {
|
||||||
|
let bold: String = chars[i + 2..close].iter().collect();
|
||||||
|
result.push_str(&color_text(&bold, "magenta"));
|
||||||
|
i = close + 2;
|
||||||
|
}
|
||||||
|
// Unterminated: the rest is literal. The old scan walked off the end
|
||||||
|
// here and dropped the final character.
|
||||||
|
None => {
|
||||||
|
result.extend(&chars[i..]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_delimiter(chars: &[char], at: usize) -> bool {
|
||||||
|
chars.get(at) == Some(&'*') && chars.get(at + 1) == Some(&'*')
|
||||||
|
}
|
||||||
|
|
||||||
pub fn parse_ticket_field(content: &str, field: &str) -> String {
|
pub fn parse_ticket_field(content: &str, field: &str) -> String {
|
||||||
let pattern = format!("**{}**:", field);
|
let pattern = format!("**{}**:", field);
|
||||||
content
|
content
|
||||||
@@ -432,21 +513,132 @@ pub fn status_dirs() -> Vec<&'static str> {
|
|||||||
vec!["backlog", "committed", "reviewing", "done"]
|
vec!["backlog", "committed", "reviewing", "done"]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type TicketItem = (String, String, String, String, String);
|
/// Lowest and highest level a ticket can carry. 1 is the most urgent, which is
|
||||||
|
/// what the `p1` to `p3` tags this replaced already meant.
|
||||||
|
pub const PRIORITY_RANGE: std::ops::RangeInclusive<u8> = 1..=5;
|
||||||
|
|
||||||
pub fn display_ticket_items(items: &Vec<TicketItem>) {
|
/// A ticket's priority as it comes off disk.
|
||||||
for (title, owner, due, uuid, ts) in items {
|
///
|
||||||
let uuid_colored = color_text(uuid, "red");
|
/// Three states, not two: a value outside the range has to stay distinguishable
|
||||||
if ts.is_empty() {
|
/// from no value at all, or a typo silently reads as "no priority".
|
||||||
println!(
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
" ({}) {} | Owner: {} | Due: {}",
|
pub enum Priority {
|
||||||
uuid_colored, title, owner, due
|
Level(u8),
|
||||||
);
|
Unset,
|
||||||
} else {
|
Invalid,
|
||||||
let ts_colored = color_text(ts, "cyan");
|
}
|
||||||
|
|
||||||
|
impl Priority {
|
||||||
|
/// Sort weight. Levels first in order, then anything wrong, then anything
|
||||||
|
/// absent, so a typo surfaces above the long tail of unset tickets.
|
||||||
|
pub fn rank(&self) -> u8 {
|
||||||
|
match self {
|
||||||
|
Priority::Level(level) => *level,
|
||||||
|
Priority::Invalid => u8::MAX - 1,
|
||||||
|
Priority::Unset => u8::MAX,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse_priority(content: &str) -> Priority {
|
||||||
|
let raw = parse_ticket_field(content, "Priority");
|
||||||
|
|
||||||
|
if is_unknown_value(&raw) {
|
||||||
|
return Priority::Unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
match raw.trim().parse::<u8>() {
|
||||||
|
Ok(level) if PRIORITY_RANGE.contains(&level) => Priority::Level(level),
|
||||||
|
_ => Priority::Invalid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct TicketItem {
|
||||||
|
pub title: String,
|
||||||
|
pub owner: String,
|
||||||
|
pub due: String,
|
||||||
|
pub id: String,
|
||||||
|
pub created: String,
|
||||||
|
pub priority: Priority,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Grey for a value that is not set, per the colour guideline.
|
||||||
|
///
|
||||||
|
/// `show` already did this through `colorize_metadata`, so the listing was the
|
||||||
|
/// one place that ignored the rule.
|
||||||
|
fn dim_if_unset(value: &str) -> String {
|
||||||
|
if is_unknown_value(value) {
|
||||||
|
color_text(value, "grey")
|
||||||
|
} else {
|
||||||
|
value.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The mark and colour for a level, from one place.
|
||||||
|
///
|
||||||
|
/// A two-segment meter that empties as the level rises, so the level is legible
|
||||||
|
/// from shape alone: colour is off whenever output is piped, and NO_COLOR turns it
|
||||||
|
/// off in a terminal too, so colour accentuates and never encodes.
|
||||||
|
///
|
||||||
|
/// Only three glyphs, the ones frig uses for its status indicators and which are
|
||||||
|
/// therefore known to render here. The quadrant circles this first used are in a
|
||||||
|
/// quarter as many fonts, so terminals substituted them from a fallback font that
|
||||||
|
/// draws them oversized. Two cells of a three-level ramp gives five steps of ink,
|
||||||
|
/// 2, 1.5, 1, 0.5, 0, without leaving that safe set.
|
||||||
|
///
|
||||||
|
/// The number counts up while the mark empties out, because 1 is the most urgent.
|
||||||
|
/// That is the convention every tracker uses and what the p1 tags this replaced
|
||||||
|
/// already meant.
|
||||||
|
pub fn priority_mark(priority: Priority) -> (&'static str, &'static str) {
|
||||||
|
match priority {
|
||||||
|
Priority::Level(1) => ("\u{25cf}\u{25cf}", "brightred"),
|
||||||
|
Priority::Level(2) => ("\u{25cf}\u{25d0}", "red"),
|
||||||
|
Priority::Level(3) => ("\u{25cf}\u{25cb}", "orange"),
|
||||||
|
Priority::Level(4) => ("\u{25d0}\u{25cb}", "cyan"),
|
||||||
|
Priority::Level(5) => ("\u{25cb}\u{25cb}", "grey"),
|
||||||
|
// Unreachable while Level is only built by parse_priority, which checks
|
||||||
|
// the range, but a level added later should not silently render blank.
|
||||||
|
Priority::Level(_) | Priority::Invalid => ("??", "brightred"),
|
||||||
|
Priority::Unset => ("\u{b7}\u{b7}", "grey"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The legend, for help text. Nothing else in a listing explains the glyphs.
|
||||||
|
pub fn priority_legend() -> String {
|
||||||
|
let levels = PRIORITY_RANGE
|
||||||
|
.map(|level| {
|
||||||
|
let (glyph, _) = priority_mark(Priority::Level(level));
|
||||||
|
format!("{} {}", glyph, level)
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(" ");
|
||||||
|
|
||||||
|
let (unset, _) = priority_mark(Priority::Unset);
|
||||||
|
format!("Priority: {levels} {unset} unset 1 is most urgent")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn show_priority(priority: Priority) -> String {
|
||||||
|
let (glyph, colour) = priority_mark(priority);
|
||||||
|
color_text(glyph, colour)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn display_ticket_items(items: &[TicketItem]) {
|
||||||
|
for item in items {
|
||||||
|
let id = color_text(&item.id, "red");
|
||||||
|
let owner = dim_if_unset(&item.owner);
|
||||||
|
let due = dim_if_unset(&item.due);
|
||||||
|
let priority = show_priority(item.priority);
|
||||||
|
|
||||||
|
if item.created.is_empty() {
|
||||||
println!(
|
println!(
|
||||||
" {} ({}) {} | Owner: {} | Due: {}",
|
" {} ({}) {} | Owner: {} | Due: {}",
|
||||||
ts_colored, uuid_colored, title, owner, due
|
priority, id, item.title, owner, due
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
let created = color_text(&item.created, "cyan");
|
||||||
|
println!(
|
||||||
|
" {} {} ({}) {} | Owner: {} | Due: {}",
|
||||||
|
priority, created, id, item.title, owner, due
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,19 +660,25 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
|
|||||||
let due = parse_ticket_field(&content, "Due");
|
let due = parse_ticket_field(&content, "Due");
|
||||||
let filename = e.path().file_stem()?.to_string_lossy().to_string();
|
let filename = e.path().file_stem()?.to_string_lossy().to_string();
|
||||||
let created_at = parse_ticket_field(&content, "Created At");
|
let created_at = parse_ticket_field(&content, "Created At");
|
||||||
let short_date = format_created_at(&created_at);
|
|
||||||
|
|
||||||
Some((
|
Some(TicketItem {
|
||||||
title,
|
title,
|
||||||
owner,
|
owner,
|
||||||
due,
|
due,
|
||||||
short_id(&filename).to_string(),
|
id: short_id(&filename).to_string(),
|
||||||
short_date,
|
created: format_created_at(&created_at),
|
||||||
))
|
priority: parse_priority(&content),
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
items.sort_by(|a, b| a.0.to_lowercase().cmp(&b.0.to_lowercase()));
|
// Priority first, title as the tiebreak, which is what the sort used to be.
|
||||||
|
items.sort_by(|a, b| {
|
||||||
|
a.priority
|
||||||
|
.rank()
|
||||||
|
.cmp(&b.priority.rank())
|
||||||
|
.then_with(|| a.title.to_lowercase().cmp(&b.title.to_lowercase()))
|
||||||
|
});
|
||||||
Ok(items)
|
Ok(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,6 +686,247 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_color_disables_colour_on_a_terminal() {
|
||||||
|
assert!(!colors_wanted(true, Some("1"), Some("xterm-256color")));
|
||||||
|
// Any value at all, per the convention
|
||||||
|
assert!(!colors_wanted(true, Some("0"), Some("xterm-256color")));
|
||||||
|
assert!(!colors_wanted(true, Some("false"), Some("xterm-256color")));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An empty value counts as unset, so a wrapper script can clear one it
|
||||||
|
/// inherited.
|
||||||
|
#[test]
|
||||||
|
fn an_empty_no_color_is_ignored() {
|
||||||
|
assert!(colors_wanted(true, Some(""), Some("xterm-256color")));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_dumb_terminal_gets_no_colour() {
|
||||||
|
assert!(!colors_wanted(true, None, Some("dumb")));
|
||||||
|
assert!(!colors_wanted(true, None, Some("")));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn colour_needs_a_terminal() {
|
||||||
|
assert!(colors_wanted(true, None, Some("xterm-256color")));
|
||||||
|
assert!(!colors_wanted(false, None, Some("xterm-256color")));
|
||||||
|
// No TERM at all is fine as long as it is a terminal
|
||||||
|
assert!(colors_wanted(true, None, None));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unset_values_are_dimmed_and_set_ones_are_not() {
|
||||||
|
// Colour is off in a test process, so this asserts the decision, not the escape
|
||||||
|
for unset in ["_Not set_", "_None_"] {
|
||||||
|
assert!(is_unknown_value(unset), "{unset} should count as unset");
|
||||||
|
assert_eq!(dim_if_unset(unset), unset);
|
||||||
|
}
|
||||||
|
|
||||||
|
for set in ["alice", "2026-12-31", "bug,frontend"] {
|
||||||
|
assert!(!is_unknown_value(set));
|
||||||
|
assert_eq!(dim_if_unset(set), set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ticket_with_priority(raw: &str) -> String {
|
||||||
|
format!("# T\n\n## Metadata\n\n- **Priority**: {}\n", raw)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_level_in_range_parses() {
|
||||||
|
for level in 1..=5u8 {
|
||||||
|
let content = ticket_with_priority(&level.to_string());
|
||||||
|
assert_eq!(parse_priority(&content), Priority::Level(level));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_missing_or_unset_level_is_unset() {
|
||||||
|
assert_eq!(parse_priority("# T\n\n## Metadata\n"), Priority::Unset);
|
||||||
|
assert_eq!(parse_priority(&ticket_with_priority("_Not set_")), Priority::Unset);
|
||||||
|
assert_eq!(parse_priority(&ticket_with_priority("_None_")), Priority::Unset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Distinct from unset on purpose: a typo must not read as "no priority".
|
||||||
|
#[test]
|
||||||
|
fn an_out_of_range_or_unparseable_level_is_invalid() {
|
||||||
|
for raw in ["0", "6", "42", "high", "-1", "1.5", "999999999999"] {
|
||||||
|
assert_eq!(
|
||||||
|
parse_priority(&ticket_with_priority(raw)),
|
||||||
|
Priority::Invalid,
|
||||||
|
"for {raw:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn levels_sort_ahead_of_invalid_which_sorts_ahead_of_unset() {
|
||||||
|
let mut ranks = [Priority::Unset, Priority::Level(5), Priority::Invalid, Priority::Level(1)]
|
||||||
|
.map(|p| p.rank());
|
||||||
|
ranks.sort();
|
||||||
|
assert_eq!(
|
||||||
|
ranks,
|
||||||
|
[
|
||||||
|
Priority::Level(1).rank(),
|
||||||
|
Priority::Level(5).rank(),
|
||||||
|
Priority::Invalid.rank(),
|
||||||
|
Priority::Unset.rank()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn each_level_gets_its_own_glyph_and_colour() {
|
||||||
|
let marks: Vec<_> = PRIORITY_RANGE
|
||||||
|
.map(|level| priority_mark(Priority::Level(level)))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let glyphs: std::collections::HashSet<_> = marks.iter().map(|(g, _)| *g).collect();
|
||||||
|
assert_eq!(glyphs.len(), marks.len(), "two levels share a glyph");
|
||||||
|
|
||||||
|
let colours: std::collections::HashSet<_> = marks.iter().map(|(_, c)| *c).collect();
|
||||||
|
assert_eq!(colours.len(), marks.len(), "two levels share a colour");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The glyph has to carry the level with colour off, which is how every pipe
|
||||||
|
/// and every opencode tool reads it.
|
||||||
|
#[test]
|
||||||
|
fn the_glyph_alone_distinguishes_every_state() {
|
||||||
|
let mut seen = std::collections::HashSet::new();
|
||||||
|
for state in PRIORITY_RANGE.map(Priority::Level).chain([Priority::Unset, Priority::Invalid]) {
|
||||||
|
let (glyph, _) = priority_mark(state);
|
||||||
|
assert!(seen.insert(glyph), "{glyph} is used for more than one state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_fullest_mark_is_the_most_urgent() {
|
||||||
|
assert_eq!(priority_mark(Priority::Level(1)).0, "\u{25cf}\u{25cf}");
|
||||||
|
assert_eq!(priority_mark(Priority::Level(5)).0, "\u{25cb}\u{25cb}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Every mark is the same width, or the column stops lining up.
|
||||||
|
#[test]
|
||||||
|
fn every_mark_is_the_same_width() {
|
||||||
|
let widths: std::collections::HashSet<usize> = PRIORITY_RANGE
|
||||||
|
.map(Priority::Level)
|
||||||
|
.chain([Priority::Unset, Priority::Invalid])
|
||||||
|
.map(|p| priority_mark(p).0.chars().count())
|
||||||
|
.collect();
|
||||||
|
assert_eq!(widths, std::collections::HashSet::from([2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The marks are built only from what frig already renders in this terminal:
|
||||||
|
/// the quadrant circles are in a quarter as many fonts and got substituted
|
||||||
|
/// from a fallback font that drew them oversized.
|
||||||
|
#[test]
|
||||||
|
fn marks_use_only_the_glyphs_known_to_render() {
|
||||||
|
let allowed = ['\u{25cf}', '\u{25d0}', '\u{25cb}', '\u{b7}', '?'];
|
||||||
|
for state in PRIORITY_RANGE
|
||||||
|
.map(Priority::Level)
|
||||||
|
.chain([Priority::Unset, Priority::Invalid])
|
||||||
|
{
|
||||||
|
for ch in priority_mark(state).0.chars() {
|
||||||
|
assert!(allowed.contains(&ch), "{ch:?} is outside the safe set");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_meter_empties_as_the_level_rises() {
|
||||||
|
let ink = |p: Priority| -> f32 {
|
||||||
|
priority_mark(p)
|
||||||
|
.0
|
||||||
|
.chars()
|
||||||
|
.map(|c| match c {
|
||||||
|
'\u{25cf}' => 1.0,
|
||||||
|
'\u{25d0}' => 0.5,
|
||||||
|
_ => 0.0,
|
||||||
|
})
|
||||||
|
.sum()
|
||||||
|
};
|
||||||
|
let mut previous = f32::MAX;
|
||||||
|
for level in PRIORITY_RANGE {
|
||||||
|
let current = ink(Priority::Level(level));
|
||||||
|
assert!(current < previous, "level {level} does not empty further");
|
||||||
|
previous = current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_invalid_level_is_marked_wrong_not_unset() {
|
||||||
|
assert_eq!(priority_mark(Priority::Invalid).0, "??");
|
||||||
|
assert_ne!(
|
||||||
|
priority_mark(Priority::Invalid),
|
||||||
|
priority_mark(Priority::Unset)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_legend_covers_every_level_and_says_which_way_it_runs() {
|
||||||
|
let legend = priority_legend();
|
||||||
|
for level in PRIORITY_RANGE {
|
||||||
|
let (glyph, _) = priority_mark(Priority::Level(level));
|
||||||
|
assert!(legend.contains(glyph), "{glyph} missing from the legend");
|
||||||
|
assert!(legend.contains(&level.to_string()));
|
||||||
|
}
|
||||||
|
assert!(legend.contains("most urgent"), "direction not spelled out");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Green means title; a priority must not borrow it.
|
||||||
|
#[test]
|
||||||
|
fn the_ramp_avoids_green() {
|
||||||
|
for level in PRIORITY_RANGE {
|
||||||
|
assert_ne!(priority_mark(Priority::Level(level)).1, "green");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn every_colour_the_code_asks_for_exists() {
|
||||||
|
for colour in ["red", "cyan", "orange", "green", "grey", "magenta", "brightred"] {
|
||||||
|
assert!(!get_color(colour).is_empty(), "{colour} is not defined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pinned deliberately. Both SGR spellings of grey failed on a real palette,
|
||||||
|
/// 90 reading nearly as light as the foreground and 37 sitting on top of it.
|
||||||
|
/// This is the exact sequence crossterm emits for ratatui's Color::DarkGray,
|
||||||
|
/// so worklane's grey is the one frig and pantop already render.
|
||||||
|
#[test]
|
||||||
|
fn grey_matches_the_indexed_colour_frig_uses() {
|
||||||
|
assert_eq!(get_color("grey"), "\x1b[38;5;8m");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// With no colour to carry the emphasis, the markers are the emphasis.
|
||||||
|
#[test]
|
||||||
|
fn bold_markers_survive_when_colour_is_off() {
|
||||||
|
let line = "Some **bold** text";
|
||||||
|
assert_eq!(colorize_bold(line, false), line);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bold_markers_are_replaced_when_colour_is_on() {
|
||||||
|
let out = colorize_bold("Some **bold** text", true);
|
||||||
|
assert!(out.contains("bold"), "was {out:?}");
|
||||||
|
assert!(!out.contains("**"), "markers left behind in {out:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The old scan ran past the end here and dropped the last character.
|
||||||
|
#[test]
|
||||||
|
fn an_unterminated_marker_keeps_the_whole_line() {
|
||||||
|
for line in ["a **bold", "**", "***", "trailing **"] {
|
||||||
|
assert_eq!(colorize_bold(line, true), line, "for {line:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn several_bold_runs_on_one_line_all_survive() {
|
||||||
|
let out = colorize_bold("**one** and **two** and rest", true);
|
||||||
|
assert!(out.contains("one") && out.contains("two") && out.ends_with("and rest"));
|
||||||
|
assert!(!out.contains("**"), "was {out:?}");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn short_id_shortens_a_full_uuid() {
|
fn short_id_shortens_a_full_uuid() {
|
||||||
assert_eq!(short_id("c230d2c6-d78a-44a5-8f5f-88fb28f84493"), "c230d2c");
|
assert_eq!(short_id("c230d2c6-d78a-44a5-8f5f-88fb28f84493"), "c230d2c");
|
||||||
|
|||||||
@@ -199,3 +199,66 @@ fn add_file_has_uuid_prefix() {
|
|||||||
assert_eq!(parts[0].len(), 36);
|
assert_eq!(parts[0].len(), 36);
|
||||||
assert_eq!(parts[0].chars().filter(|c| c.is_ascii_hexdigit()).count(), 32);
|
assert_eq!(parts[0].chars().filter(|c| c.is_ascii_hexdigit()).count(), 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_writes_the_priority_field() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
setup_worklane(&temp);
|
||||||
|
|
||||||
|
Command::cargo_bin(BIN_NAME)
|
||||||
|
.unwrap()
|
||||||
|
.current_dir(&temp.path())
|
||||||
|
.args(["add", "--title", "Urgent thing", "--priority", "1"])
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
|
||||||
|
let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog"))
|
||||||
|
.unwrap()
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.collect();
|
||||||
|
let content = fs::read_to_string(files[0].path()).unwrap();
|
||||||
|
assert!(content.contains("- **Priority**: 1"), "was {content:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_leaves_priority_unset_when_omitted() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
setup_worklane(&temp);
|
||||||
|
|
||||||
|
Command::cargo_bin(BIN_NAME)
|
||||||
|
.unwrap()
|
||||||
|
.current_dir(&temp.path())
|
||||||
|
.args(["add", "--title", "Whenever"])
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
|
||||||
|
let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog"))
|
||||||
|
.unwrap()
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.collect();
|
||||||
|
let content = fs::read_to_string(files[0].path()).unwrap();
|
||||||
|
assert!(content.contains("- **Priority**: _Not set_"), "was {content:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Rejected at parse time, so no ticket is written at all.
|
||||||
|
#[test]
|
||||||
|
fn add_rejects_a_level_outside_the_range() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
// The `=` form, so a negative value reaches the validator instead of being
|
||||||
|
// read as a flag.
|
||||||
|
for bad in ["0", "6", "high", "-1"] {
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path())
|
||||||
|
.args(["add", "--title", "Bad level", &format!("--priority={bad}")])
|
||||||
|
.assert()
|
||||||
|
.failure();
|
||||||
|
|
||||||
|
let stderr = String::from_utf8(cmd.assert().get_output().stderr.clone()).unwrap();
|
||||||
|
assert!(stderr.contains("priority must be"), "for {bad}: {stderr}");
|
||||||
|
}
|
||||||
|
|
||||||
|
let count = fs::read_dir(worklane.join("backlog")).unwrap().count();
|
||||||
|
assert_eq!(count, 0, "a ticket was written despite a bad level");
|
||||||
|
}
|
||||||
|
|||||||
@@ -212,3 +212,41 @@ fn comment_falls_back_to_git_user_when_owner_omitted() {
|
|||||||
let content = fs::read_to_string(files[0].path()).unwrap();
|
let content = fs::read_to_string(files[0].path()).unwrap();
|
||||||
assert!(content.contains("**Author**"));
|
assert!(content.contains("**Author**"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Second-resolution filenames meant the second of two quick comments
|
||||||
|
/// truncated the first.
|
||||||
|
#[test]
|
||||||
|
fn comments_added_back_to_back_are_both_kept() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
let uuid = create_ticket(&worklane, "backlog", "Rapid Fire");
|
||||||
|
|
||||||
|
for body in ["first comment", "second comment", "third comment"] {
|
||||||
|
Command::cargo_bin(BIN_NAME)
|
||||||
|
.unwrap()
|
||||||
|
.current_dir(&temp.path())
|
||||||
|
.arg("comment")
|
||||||
|
.args([&uuid, body])
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
let comments_dir = worklane.join("comments").join(&uuid);
|
||||||
|
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||||
|
.unwrap()
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.collect();
|
||||||
|
assert_eq!(files.len(), 3, "a comment was overwritten");
|
||||||
|
|
||||||
|
// And show has to render them in the order they were added
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path()).arg("show").arg(&uuid);
|
||||||
|
let assert = cmd.assert().success();
|
||||||
|
let stdout = String::from_utf8(assert.get_output().stdout.clone()).unwrap();
|
||||||
|
|
||||||
|
let first = stdout.find("first comment").expect("first comment missing");
|
||||||
|
let second = stdout.find("second comment").expect("second comment missing");
|
||||||
|
let third = stdout.find("third comment").expect("third comment missing");
|
||||||
|
assert!(first < second && second < third, "comments out of order");
|
||||||
|
}
|
||||||
|
|||||||
@@ -216,3 +216,83 @@ fn ls_survives_a_malformed_created_at() {
|
|||||||
// Unparseable, so the timestamp column is dropped rather than printed raw
|
// Unparseable, so the timestamp column is dropped rather than printed raw
|
||||||
assert!(!stdout.contains("日本語"));
|
assert!(!stdout.contains("日本語"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_ticket_with_priority(worklane_dir: &std::path::PathBuf, title: &str, priority: &str) {
|
||||||
|
let slug: String = title.to_lowercase().replace(' ', "-");
|
||||||
|
let body = format!(
|
||||||
|
"# {}\n\n## Metadata\n\n- **ID**: 00000000-0000-0000-0000-00000000000{}\n\
|
||||||
|
- **Priority**: {}\n- **Tags**: test\n- **Due**: _Not set_\n\
|
||||||
|
- **Owner**: alice\n- **Status**: backlog\n",
|
||||||
|
title,
|
||||||
|
slug.len() % 10,
|
||||||
|
priority
|
||||||
|
);
|
||||||
|
let filename = format!("0000000{}-0000-0000-0000-000000000001_{}.md", slug.len() % 10, slug);
|
||||||
|
fs::write(worklane_dir.join("backlog").join(filename), body).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ls_sorts_by_priority_then_title() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
create_ticket_with_priority(&worklane, "Zebra urgent", "1");
|
||||||
|
create_ticket_with_priority(&worklane, "Apple later", "4");
|
||||||
|
create_ticket_with_priority(&worklane, "Middle one", "2");
|
||||||
|
create_ticket(&worklane, "backlog", "No priority at all", "alice", "_Not set_");
|
||||||
|
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path()).arg("ls").arg("backlog");
|
||||||
|
let stdout = get_stdout(&mut cmd);
|
||||||
|
|
||||||
|
let at = |needle: &str| stdout.find(needle).unwrap_or_else(|| panic!("{needle} missing"));
|
||||||
|
assert!(at("Zebra urgent") < at("Middle one"), "priority 1 must lead");
|
||||||
|
assert!(at("Middle one") < at("Apple later"), "2 before 4");
|
||||||
|
// Unset sorts last even though its title would come first alphabetically
|
||||||
|
assert!(at("Apple later") < at("No priority at all"), "unset must trail");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ls_filters_by_priority_and_composes_with_status() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
create_ticket_with_priority(&worklane, "Urgent one", "1");
|
||||||
|
create_ticket_with_priority(&worklane, "Lower one", "3");
|
||||||
|
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path())
|
||||||
|
.args(["ls", "backlog", "--priority", "1"]);
|
||||||
|
let stdout = get_stdout(&mut cmd);
|
||||||
|
assert!(stdout.contains("Urgent one"));
|
||||||
|
assert!(!stdout.contains("Lower one"), "filter let a level 3 through");
|
||||||
|
|
||||||
|
// Same filter without a status, through the grouped listing
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path()).args(["ls", "--priority", "3"]);
|
||||||
|
let stdout = get_stdout(&mut cmd);
|
||||||
|
assert!(stdout.contains("Lower one"));
|
||||||
|
assert!(!stdout.contains("Urgent one"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ls_shows_a_mark_for_the_level() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
create_ticket_with_priority(&worklane, "Top level", "1");
|
||||||
|
create_ticket_with_priority(&worklane, "Bottom level", "5");
|
||||||
|
create_ticket(&worklane, "backlog", "Nothing set", "alice", "_Not set_");
|
||||||
|
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path()).arg("ls").arg("backlog");
|
||||||
|
let stdout = get_stdout(&mut cmd);
|
||||||
|
|
||||||
|
// Piped, so no escapes: the glyph is carrying the level by itself
|
||||||
|
assert!(!stdout.contains('\u{1b}'));
|
||||||
|
assert!(stdout.contains("\u{25cf}\u{25cf} "), "no full meter for level 1 in {stdout:?}");
|
||||||
|
assert!(stdout.contains("\u{25cb}\u{25cb} "), "no empty meter for level 5");
|
||||||
|
assert!(stdout.contains("\u{b7}\u{b7} "), "no unset mark");
|
||||||
|
// The raw number is not what the listing shows
|
||||||
|
assert!(!stdout.contains(" 1 "), "the digit leaked into the row");
|
||||||
|
}
|
||||||
|
|||||||
@@ -393,3 +393,30 @@ fn show_searches_across_all_statuses() {
|
|||||||
assert!(stdout.contains("Committed Task"));
|
assert!(stdout.contains("Committed Task"));
|
||||||
assert!(stdout.contains("This is in committed."));
|
assert!(stdout.contains("This is in committed."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn show_renders_the_priority_mark_beside_the_number() {
|
||||||
|
let temp = TempDir::new().unwrap();
|
||||||
|
let worklane = setup_worklane(&temp);
|
||||||
|
|
||||||
|
let filename = "abc123def456789012345678901234567890_prio.md";
|
||||||
|
fs::write(
|
||||||
|
worklane.join("backlog").join(filename),
|
||||||
|
"# Prio Ticket\n\n## Metadata\n\n- **ID**: abc123def456789012345678901234567890\n\
|
||||||
|
- **Priority**: 2\n- **Status**: backlog\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||||
|
cmd.current_dir(&temp.path()).arg("show").arg("Prio");
|
||||||
|
let stdout = get_stdout(&mut cmd);
|
||||||
|
|
||||||
|
// Mark for the eye, number still there for the file's sake
|
||||||
|
assert!(stdout.contains("\u{25cf}\u{25d0}"), "no mark in {stdout:?}");
|
||||||
|
assert!(stdout.contains("Priority"));
|
||||||
|
assert!(stdout.contains('2'));
|
||||||
|
|
||||||
|
// And the file itself is untouched
|
||||||
|
let content = fs::read_to_string(worklane.join("backlog").join(filename)).unwrap();
|
||||||
|
assert!(content.contains("- **Priority**: 2"));
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user