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
2 changes: 1 addition & 1 deletion assets/docs/getting-started/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Example:

```bash
buridan apply --preset b0
buridan apply --preset b2D0wqNxT
buridan apply --preset b1000
```

Re-running `buridan apply` with a different preset overwrites the theme section of `components.json` and the generated CSS variables — it does not touch any components you've already added.
Expand Down
2 changes: 1 addition & 1 deletion assets/docs/getting-started/components-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The raw preset ID from the [theme builder](/docs/getting-started/cli#create), ex
```json
{
"theme": {
"preset": "b2D0wqNxT"
"preset": "b1000"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Example:

```bash
buridan apply --preset b0
buridan apply --preset b2D0wqNxT
buridan apply --preset b1000
```

## add
Expand Down
5 changes: 3 additions & 2 deletions cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ def cmd_apply(preset: str):
)
if not config:
print(
f"Error: Invalid preset ID '{preset}'. Get a valid preset from https://buridan-ui.com/create"
f"Error: Invalid preset ID '{preset}'. Get a valid preset from https://buridan.reflex.run/create",
file=sys.stderr,
)
sys.exit(1)

Expand Down Expand Up @@ -621,7 +622,7 @@ def main():
sub.add_parser("create", help="Open the Buridan UI theme builder in your browser")

apply_p = sub.add_parser(
"apply", help="Apply a theme preset (from buridan-ui.com/create)"
"apply", help="Apply a theme preset (from buridan.reflex.run/create)"
)
apply_p.add_argument(
"--preset", required=True, help="Preset ID e.g. b0 or b2D0wqNxT"
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Example:

```bash
buridan apply --preset b0
buridan apply --preset b2D0wqNxT
buridan apply --preset b1000
```

Re-running `buridan apply` with a different preset overwrites the theme section of `components.json` and the generated CSS variables — it does not touch any components you've already added.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/components-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The raw preset ID from the [theme builder](/docs/getting-started/cli#create), ex
```json
{
"theme": {
"preset": "b2D0wqNxT"
"preset": "b1000"
}
}
```
Expand Down
28 changes: 28 additions & 0 deletions tests/test_cli_apply_preset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from cli import main as cli_main


def test_documented_example_preset_decodes():
cfg = cli_main.decode_seed(
"b1000",
cli_main.BASE_THEMES,
cli_main.COLOR_THEMES,
cli_main.STYLE_REGISTRY,
cli_main.RADII_OPTIONS,
cli_main.FONT_REGISTRY,
)
assert cfg


def test_invalid_preset_errors_to_stderr(tmp_path, monkeypatch, capsys):
(tmp_path / "rxconfig.py").write_text("")
monkeypatch.chdir(tmp_path)
with pytest.raises(SystemExit) as exc:
cli_main.cmd_apply("zzz-invalid")
assert exc.value.code == 1
out = capsys.readouterr()
assert "Invalid preset ID" in out.err
assert "buridan.reflex.run/create" in out.err
assert "buridan-ui.com" not in out.err
assert out.out == ""