From df7cf757f7e39cabf7a849391debba92b668d5eb Mon Sep 17 00:00:00 2001 From: Noah Gardner Date: Fri, 25 Sep 2026 10:44:36 -0400 Subject: [PATCH] docs: hub imports at v0.2.0 and a plain Bend install Install now leads with plain Bend: import 0x085b03c84ca37125e38dddede7b91e55 (shake v0.2.0, on hub.bend-lang.com) and bend fetches it on the first run. ez is the second option. Every Bend block in the README was checked (or run) with bend 2.0.27 from an empty HOME with only bend on PATH. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afa2270..861a026 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,45 @@ commands; `help` writes usage. ## Install -Use with [Bend](https://github.com/bendlang/bend) or install easily with [ez](https://github.com/Emerging-Patterns/ez): +With [Bend](https://github.com/bendlang/bend) alone there is nothing to +install: import shake by its hub name and `bend` fetches it from +[the hub](https://hub.bend-lang.com) into `~/.bend/lib` on the first run. +`0x085b03c84ca37125e38dddede7b91e55` is shake v0.2.0. + +``` +import 0x085b03c84ca37125e38dddede7b91e55/main.bend as Shake +``` + +Or with [ez](https://github.com/Emerging-Patterns/ez), which records the +package in `ez.toml` (`ez init` makes one): ``` -ez init ez add Emerging-Patterns/shake ``` ## Usage +A spec, a parse, and a read. `parse` answers `Done` with what the words +bound, or `Fail` with why they could not be bound: + ``` -import 0xdf41d30432187d983a3c5b9db32d376d/main.bend as Shake +import 0x085b03c84ca37125e38dddede7b91e55/main.bend as Shake + +def spec() -> Shake.Cli: + Shake.app("hi", "Say hello.", None{}, + [Shake.opt("name", Some{"n"}, Some{"name"}, "Who to greet", False{}, + Some{"world"}, [])], + []) + +def greet(got: Result<&2, &2, Shake.ParseErr, Shake.Matched>) -> String: + match got: + case Done{mm}: + "hello " ++ Maybe.default(&2, String, Shake.get(mm, "name"), "") + case Fail{ee}: + Shake.err_text(spec(), ee) + +def main() -> String: + greet(Shake.parse(spec(), ["--name", "Ada"])) ``` `main.bend` is the whole interface: the types (`Shake.Cli`, `Shake.Sub`,