Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ python main.py 100 --exit-after-create

The flag is recognised only in that second position. Given first, as in `python main.py --exit-after-create`, it is read as a grid size that cannot be parsed: `Invalid grid size argument, using default of 50.` is printed and the render loop is entered as usual. Apart from `--help` and `-h` (below), any other second argument, and every argument after the second, is ignored without a message.

Passing `--help` or `-h` in any position prints a usage line and exits with status `0`, before a window is opened, Viron is contacted, a file is written or usage reporting starts:
Passing `--help` or `-h` in any position prints the usage line, `Usage: python main.py [gridSize [--exit-after-create]]`, and exits with status `0`, before a window is opened, Viron is contacted, a file is written or usage reporting starts. The nested brackets show that `--exit-after-create` may only follow a grid size:

```bash
python main.py --help
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
numGrids = 1
defaultGridSize = 50

usage = "Usage: python main.py [gridSize] [--exit-after-create]"
usage = "Usage: python main.py [gridSize [--exit-after-create]]"

def log(message):
print(message)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_asking_for_usage_prints_it_and_exits_without_side_effects(self):
runpy.run_module("main", run_name="__main__")

self.assertEqual(caught.exception.code, 0)
self.assertIn("Usage: python main.py [gridSize] [--exit-after-create]", output.getvalue())
self.assertIn("Usage: python main.py [gridSize [--exit-after-create]]", output.getvalue())
mockStartUsageReporting.assert_not_called()
mockRenderWindow.assert_not_called()
self.assertEqual(os.listdir("."), [])
Expand Down
Loading