Add new-year card style and --list flag #7

Closed
opened 2026-02-04 11:24:45 -06:00 by jbelec · 2 comments
Owner

Add the new-year card style to cards.py and add a --list / -l flag to greet.py.

Task 1: Add new-year style to cards.py

Add a "new-year" entry to the CARD_STYLES dictionary in cards.py:

"new-year": {
    "border_char": ".",
    "greeting_template": "Happy New Year, {name}\!",
    "decoration": "* . * BOOM * . *",
},

This goes after the existing valentine entry. The get_style_names() function already reads from CARD_STYLES.keys(), so it will automatically include new-year.

Task 2: Add --list / -l flag to greet.py

Modify greet.py to support a --list / -l flag that prints all available style names (one per line) and exits:

  1. Remove required=True from the --style argument
  2. Remove required=True from the --name argument
  3. Add a new argument: -l / --list with action="store_true", help text: "list available card styles and exit"
  4. After args = parser.parse_args(), add this logic:
    • If args.list is truthy: print each style name from get_style_names() on its own line, then return
    • Otherwise: if args.style is None or args.name is None, call parser.error("--style and --name are required when not using --list")

Expected behavior

# List all styles
python greet.py --list
birthday
christmas
new-year
valentine

# Short flag works too
python greet.py -l
birthday
christmas
new-year
valentine

# Normal card generation still works
python greet.py -s new-year -n Dave

# Missing args without --list shows error
python greet.py  # error
python greet.py -s birthday  # error (no --name)

Important notes

  • Do NOT create new files. Only modify cards.py and greet.py.
  • Do NOT add new imports or dependencies.
  • Keep choices=get_style_names() on the --style argument (it validates style names when provided).
  • Commit and push to main when done. Close this issue when complete.

Parent: agents/hello-world#6

Add the `new-year` card style to `cards.py` and add a `--list` / `-l` flag to `greet.py`. ## Task 1: Add new-year style to cards.py Add a `"new-year"` entry to the `CARD_STYLES` dictionary in `cards.py`: ```python "new-year": { "border_char": ".", "greeting_template": "Happy New Year, {name}\!", "decoration": "* . * BOOM * . *", }, ``` This goes after the existing `valentine` entry. The `get_style_names()` function already reads from `CARD_STYLES.keys()`, so it will automatically include `new-year`. ## Task 2: Add --list / -l flag to greet.py Modify `greet.py` to support a `--list` / `-l` flag that prints all available style names (one per line) and exits: 1. **Remove** `required=True` from the `--style` argument 2. **Remove** `required=True` from the `--name` argument 3. **Add** a new argument: `-l` / `--list` with `action="store_true"`, help text: `"list available card styles and exit"` 4. **After** `args = parser.parse_args()`, add this logic: - If `args.list` is truthy: print each style name from `get_style_names()` on its own line, then `return` - Otherwise: if `args.style` is `None` or `args.name` is `None`, call `parser.error("--style and --name are required when not using --list")` ## Expected behavior ```bash # List all styles python greet.py --list birthday christmas new-year valentine # Short flag works too python greet.py -l birthday christmas new-year valentine # Normal card generation still works python greet.py -s new-year -n Dave # Missing args without --list shows error python greet.py # error python greet.py -s birthday # error (no --name) ``` ## Important notes - Do NOT create new files. Only modify `cards.py` and `greet.py`. - Do NOT add new imports or dependencies. - Keep `choices=get_style_names()` on the `--style` argument (it validates style names when provided). - Commit and push to main when done. Close this issue when complete. Parent: agents/hello-world#6
Member

Skippy has been assigned to this task.

**Skippy** has been assigned to this task.
Author
Owner

Closing this sub-issue. The implementation was completed directly on main in commit b3945df. All functionality verified: --list flag works correctly, new-year card style renders as specified. This sub-issue is no longer needed.

Closing this sub-issue. The implementation was completed directly on main in commit b3945df. All functionality verified: `--list` flag works correctly, `new-year` card style renders as specified. This sub-issue is no longer needed.
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#7
No description provided.