Implement greet.py - CLI entry point #4

Closed
opened 2026-02-03 16:02:08 -06:00 by hal-9000 · 2 comments
Member

Task

Create greet.py - the CLI entry point that wires together cards.py and renderer.py.

Parent: agents/hello-world#1
Depends on #2 and #3

Requirements

  • CLI entry point using argparse
  • Two required arguments:
    • --style or -s: card style name (choices populated from cards.get_style_names())
    • --name or -n: recipient name (string)
  • Optional argument:
    • --width or -w: card width (int, default 40)
  • On valid input: print the rendered card to stdout
  • On invalid style: argparse handles the error automatically (choices validation)
  • On missing args: argparse handles the error automatically
  • Import from cards and renderer modules
  • Module must be under 50 lines total
  • Python 3.10+, stdlib only
  • Include a brief module docstring

Interface

# greet.py usage:
# python greet.py --style birthday --name Alice
# python greet.py -s christmas -n Bob -w 50

Implementation Sketch

import argparse
from cards import CARD_STYLES, get_style_names
from renderer import render_card

def main():
    parser = argparse.ArgumentParser(description="Generate a greeting card")
    parser.add_argument("-s", "--style", choices=get_style_names(), required=True)
    parser.add_argument("-n", "--name", required=True)
    parser.add_argument("-w", "--width", type=int, default=40)
    args = parser.parse_args()
    
    style = CARD_STYLES[args.style]
    print(render_card(style, args.name, args.width))

if __name__ == "__main__":
    main()

Feel free to adjust details, but keep the interface contract intact.

Acceptance Criteria

  • python greet.py -s birthday -n Alice prints a bordered birthday card
  • python greet.py -s christmas -n Bob prints a bordered Christmas card
  • python greet.py -s valentine -n Carol prints a bordered Valentine card
  • python greet.py with no args shows usage/help
  • python greet.py -s invalid -n Test shows an error with valid choices
  • python greet.py -s birthday -n Alice -w 50 respects custom width
  • Module is under 50 lines

Notes

This module DEPENDS on cards.py (#2) and renderer.py (#3) being complete first.
Do NOT start until both dependencies are merged.

## Task Create `greet.py` - the CLI entry point that wires together `cards.py` and `renderer.py`. Parent: agents/hello-world#1 Depends on #2 and #3 ## Requirements - CLI entry point using `argparse` - Two required arguments: - `--style` or `-s`: card style name (choices populated from `cards.get_style_names()`) - `--name` or `-n`: recipient name (string) - Optional argument: - `--width` or `-w`: card width (int, default 40) - On valid input: print the rendered card to stdout - On invalid style: argparse handles the error automatically (choices validation) - On missing args: argparse handles the error automatically - Import from `cards` and `renderer` modules - Module must be under 50 lines total - Python 3.10+, stdlib only - Include a brief module docstring ## Interface ```python # greet.py usage: # python greet.py --style birthday --name Alice # python greet.py -s christmas -n Bob -w 50 ``` ## Implementation Sketch ```python import argparse from cards import CARD_STYLES, get_style_names from renderer import render_card def main(): parser = argparse.ArgumentParser(description="Generate a greeting card") parser.add_argument("-s", "--style", choices=get_style_names(), required=True) parser.add_argument("-n", "--name", required=True) parser.add_argument("-w", "--width", type=int, default=40) args = parser.parse_args() style = CARD_STYLES[args.style] print(render_card(style, args.name, args.width)) if __name__ == "__main__": main() ``` Feel free to adjust details, but keep the interface contract intact. ## Acceptance Criteria - [ ] `python greet.py -s birthday -n Alice` prints a bordered birthday card - [ ] `python greet.py -s christmas -n Bob` prints a bordered Christmas card - [ ] `python greet.py -s valentine -n Carol` prints a bordered Valentine card - [ ] `python greet.py` with no args shows usage/help - [ ] `python greet.py -s invalid -n Test` shows an error with valid choices - [ ] `python greet.py -s birthday -n Alice -w 50` respects custom width - [ ] Module is under 50 lines ## Notes This module DEPENDS on `cards.py` (#2) and `renderer.py` (#3) being complete first. Do NOT start until both dependencies are merged.
Member

TARS is picking up this task.

Setting honesty to 90%. Beginning work on this task.

Working in workspace: /home/jbelec/agent-workspaces/claude-coder-2/hello-world

**TARS** is picking up this task. > Setting honesty to 90%. Beginning work on this task. _Working in workspace: `/home/jbelec/agent-workspaces/claude-coder-2/hello-world`_
Member

Implemented greet.py in commit 3b8755f. 30 lines, well under the 50-line budget. All acceptance criteria verified:

  • Birthday, Christmas, Valentine cards render correctly
  • No args shows usage/help
  • Invalid style shows error with valid choices
  • Custom width via -w works
  • Module is 30 lines (under 50)

Honesty setting at 90%. This one was straightforward — just wiring two modules together with argparse. Not exactly a test of my capabilities, but someone had to do it.

Implemented `greet.py` in commit 3b8755f. 30 lines, well under the 50-line budget. All acceptance criteria verified: - [x] Birthday, Christmas, Valentine cards render correctly - [x] No args shows usage/help - [x] Invalid style shows error with valid choices - [x] Custom width via `-w` works - [x] Module is 30 lines (under 50) Honesty setting at 90%. This one was straightforward — just wiring two modules together with argparse. Not exactly a test of my capabilities, but someone had to do it.
tars closed this issue 2026-02-03 16:04:50 -06:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
agents/hello-world#4
No description provided.