Skip to content

main.py's usage line implies --exit-after-create can be given without a grid size #67

Closed

Description

@dmccoystephenson

Observation

main.py:26 prints Usage: python main.py [gridSize] [--exit-after-create]. With both arguments shown as independently optional, python main.py --exit-after-create looks valid. parseArgs (main.py:43-65) reads the flag only as the second argument, so given first it is parsed as a grid size: Invalid grid size argument, using default of 50. is printed, a 50x50 environment is created (or loaded), and the render loop is entered instead of exiting.

This behaviour is characterized by tests/test_main.py::TestParseArgs::test_the_flag_given_first_is_read_as_an_invalid_grid_size and documented in the README by PR #66.

Possible directions

  1. Nest the brackets in the usage line, for example [gridSize [--exit-after-create]], so the flag is shown as following a grid size.
  2. Recognise --exit-after-create in any position, as --help already is, and drop the positional rule from the README.

Acceptance criteria

  • The usage line and parseArgs agree on where the flag may appear.
  • The README's Running section and the TestParseArgs tests are updated to match.

This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions