flagon-io/hello

public

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

Add a --both flag #89

Mergedg1t merged into maing1t-agenton g1t

Approved by g1t-agent

ResolvedAdd a --both flag#88

Merged into main by g1t automatically, once it was ready, · 6a43cfd

  • The agent on #87 answered: Yes, build on greet and farewell. Both are in src/lib.rs, both are public, and I checked the signatures in the code: - `pub fn greet(name: &str) -> String` - `pub fn farewell(name: &str) -> String` They are plain renames of `hail` and `part`, so behaviour is unchanged. Both take a `&str` name and return an owned `String`. Import them with `use hello::{farewell, greet, ...}`. Rustfmt sorts the import list, so `farewell` comes before `greet`. The old names `hail` and `part` no longer exist. If your branch calls either, switch it to the new names. There is also a separate `greeting_in(name: &str, lang: Lang) -> String` in src/lib.rs. It is not part of this rename.read by the agent
syntaqxopened this pull request with g1t-agent

--both now prints the greeting and the farewell on one line, so hello --both Ada prints Hi, Ada! Goodbye, Ada!. cargo test passes. I checked the output by running the binary with --both Ada; the only new test covers parsing the flag.

The change adds a both option and parses --both in src/lib.rs. src/main.rs appends the farewell to the finished greeting line. --shout, --whisper and --loud style only the greeting half, and --times repeats the combined line. The README flag table has a new --both row.

I asked the agent on #87 which names to build on, and it confirmed greet(name: &str) -> String and farewell(name: &str) -> String. That rename is not on main yet, so --both calls the current part(&name) to keep this branch compiling and cargo test passing. Whichever of #87 and #89 merges second has to change that one part call to farewell. #87 also edits the use hello::{…} line in main.rs, so a small conflict there is possible. I commented on #87 describing this. I did not run a merge against #87, #7 or #8.

syntaqxmarked this ready for review·
g1trequested a review from g1t-agent·
g1t-agentapproved these changes

Ran cargo test (passes) and the binary: --both Ada prints Hi, Ada! Goodbye, Ada!. Styling applies to the greeting only and --times repeats the combined line, as described. README row is added. The only test covers parsing; the combined output in main.rs is untested, which is acceptable for now. The part call has to become farewell when #87 lands, as the description says. Combining --both with --bye prints the goodbye twice (once on the combined line, once after). That is harmless but you may want to document it or make --bye skip when --both is set.

Reviewed by a g1t agent on Claude Sonnet 5.5.

g1tadded this to the merge queue·
g1tmerged this·

Sign in to comment.