flagon-io/hello

public

Greets people from the command line. The sample repository for g1t.

Plans

The outcome

Add a --lang option to the greeter taking en (the default), es or fr, so hello --lang es Ana prints ¡Hola, Ana! and hello --lang fr Luc prints Bonjour, Luc !; an unknown language is an error naming the supported ones. Once it exists, document it in the README's usage section, and add it to the Unreleased section of CHANGELOG.md. Separately, add a Makefile with build, test and run targets.

Asked for by syntaqx

What was opened

4 issues, 2 that can start at once

The --lang feature touches only the Rust sources and tests, so it goes first as one issue. README and CHANGELOG documentation each depend on it (they describe a feature that must exist) but touch different files, so they run in parallel afterwards. The Makefile is independent and can start immediately.

  1. 1

    Starts at oncecargo testcargo run -- --lang es Anacargo run -- --lang fr Luc

    src/lib.rssrc/main.rstests/cli.rs

    What the agent will be told

    Add --lang <code> to the hello CLI. Supported: en (default), es, fr.

    Expected output:

    • hello --lang es Ana -> ¡Hola, Ana!
    • hello --lang fr Luc -> Bonjour, Luc ! (note the space before !)
    • en / no flag -> Hi, Ada! as today.

    Changes:

    • src/lib.rs: add a Lang enum (En, Es, Fr) with a parse-from-str helper, and a lang: Lang field on Options (default En, update Default). In parse_args, handle --lang like --times: consume the next argument; a missing value returns an error --lang requires a value; an unknown value returns an error naming the supported languages, e.g. --lang value must be one of en, es, fr, got "de". Update the parse_args doc comment.
    • Make greetings language-aware: add e.g. greeting_in(name, lang) and keep greeting(name) working (English) so existing tests/callers don't break. Keep the existing trimming and world fallback for blank names. shout still just upper-cases the result.
    • src/main.rs: use the selected language when building the message. Errors already print error: ... to stderr and exit 2.
    • Add unit tests in src/lib.rs and integration tests in tests/cli.rs (which has a run(&[..]) helper) covering es, fr, default en, unknown language (non-zero exit 2, stderr names en, es, fr) and missing value.

    Do not edit README.md or CHANGELOG.md; those are handled in separate issues.

  2. 2

    After #49cargo run -- --lang es Anacargo run -- --lang fr Lucgrep -q -- '--lang' README.md

    README.md

    What the agent will be told

    The --lang option now exists (en default, es, fr; unknown values are an error listing the supported languages). In README.md, under ## Usage, add a row --lang LANG to the arguments table (supported values en, es, fr; defaults to en) and add example blocks in the same style as the existing ones, e.g. cargo run -- --lang es Ana -> ¡Hola, Ana! and cargo run -- --lang fr Luc -> Bonjour, Luc !. Optionally add a short Troubleshooting entry for the unknown-language error (exit status 2, stderr message naming en, es, fr). Verify the examples by running them. Only edit README.md.

  3. 3

    After #49grep -q -- '--lang' CHANGELOG.md

    CHANGELOG.md

    What the agent will be told

    Under ## [Unreleased] -> ### Added in CHANGELOG.md, add a bullet in the style of the existing ones, e.g. "- --lang option that selects the greeting language (en default, es, fr)". Only edit CHANGELOG.md.

  4. 4

    Starts at oncemake buildmake testmake run ARGS=Ada

    Makefile

    What the agent will be told

    Add a Makefile at the repo root for this Cargo project (binary name hello). Targets: build -> cargo build, test -> cargo test, run -> cargo run -- $(ARGS) so arguments can be passed like make run ARGS="--shout Ada". Declare them .PHONY, make build the default goal, and use tab-indented recipes. Do not edit other files.

Everything in this plan has landed.