Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 45 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ serde_json = "1.0.150"
crossterm = "0.28"
ttf-parser = { version = "0.25.1", default-features = false, features = ["std"] }
dialoguer = { version = "0.11", default-features = false }
compact_str = "0.10.0"
bitflags = "2.13.1"
1 change: 1 addition & 0 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ shell-use mouse drag 2 2 20 2 # drag from (2,2) to (20,2)
shell-use cells 0 0 10 1 # inspect char/fg/bg/flags
shell-use expect text "ERROR" --fg "#ff0000" # text present AND red
shell-use expect text "OK" --fg 2 --bg 0 # ansi-256 fg/bg
shell-use expect text "plain" --fg default # asserts the cell set no color
```

## Workflow: snapshot testing
Expand Down
25 changes: 24 additions & 1 deletion bindings/js/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
export type Color = "default" | number | string;

/** `"none"` is a value, not an absence: an un-underlined cell reports it. */
export type UnderlineStyle =
| "none"
| "single"
| "double"
| "curly"
| "dotted"
| "dashed";

export type Shell =
| "bash"
| "powershell"
Expand All @@ -24,13 +33,27 @@ export interface Size {
export interface Cell {
x: number;
y: number;
/** The cell's grapheme; `" "` when blank, `""` for the second column of a double-width character. */
char: string;
fg: Color;
bg: Color;
bold: boolean;
dim: boolean;
italic: boolean;
underline: boolean;
inverse: boolean;
invisible: boolean;
strike: boolean;
/** Always `false` from the alacritty backend, which cannot report blink. */
blink: boolean;
/** Shorthand for `underline_style !== "none"`. */
underline: boolean;
underline_style: UnderlineStyle;
/**
* `"default"` means the underline follows the text color. Tracked
* independently of `underline_style`, so a cell that set SGR 58 without an
* underline still reports the color it would use.
*/
underline_color: Color;
}

export interface State {
Expand Down
19 changes: 17 additions & 2 deletions bindings/python/src/shell_use/types.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Literal, Optional, Union

Color = Union[str, int]
#: ``"none"`` is a value, not an absence: an un-underlined cell reports it.
UnderlineStyle = Literal["none", "single", "double", "curly", "dotted", "dashed"]


@dataclass
class Cell:
x: int
y: int
#: The cell's grapheme; ``" "`` when blank, ``""`` for the second column
#: of a double-width character.
char: str
fg: Color
bg: Color
bold: bool
dim: bool
italic: bool
underline: bool
inverse: bool
invisible: bool
strike: bool
#: Always ``False`` from the alacritty backend, which cannot report blink.
blink: bool
#: Shorthand for ``underline_style != "none"``.
underline: bool
underline_style: UnderlineStyle
#: ``"default"`` means the underline follows the text color. Tracked
#: independently of ``underline_style``, so a cell that set SGR 58 without
#: an underline still reports the color it would use.
underline_color: Color


@dataclass
Expand Down
Loading
Loading