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 @@ -118,7 +118,7 @@ list --sort name
list -s impact
```

Supported `--sort` values are `name`, `impact`, `confidence`, `ease`, `reach`, `effort`, `ice` and `rice`. Every value except `name` sorts from highest to lowest; omitting `--sort` keeps the order in which projects were created. Values are not case-sensitive, so `--sort ICE` works too. Any other value prints `Invalid sort option. Use one of: name, impact, confidence, ease, reach, effort, ice, rice (or omit --sort to keep creation order).` and lists nothing. The sort value is checked only when projects are saved: with none, `list` prints `No projects found.` whatever `--sort` was given.
Supported `--sort` values are `name`, `impact`, `confidence`, `ease`, `reach`, `effort`, `ice` and `rice`. Every value except `name` sorts from highest to lowest; omitting `--sort` keeps the order in which projects were created. Values are not case-sensitive, so `--sort ICE` works too. `--sort none` is also accepted, in any capitalization, and does the same as omitting `--sort`: creation order under a plain `Projects:` header. Any other value prints `Invalid sort option. Use one of: name, impact, confidence, ease, reach, effort, ice, rice (or omit --sort to keep creation order).` and lists nothing. The sort value is checked only when projects are saved: with no projects saved, `list` prints `No projects found.` whatever `--sort` was given.

With only the project made by the create examples' option-only command saved, `list --sort ice` prints:
```text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ void shouldPreserveCreationOrderWhenNoSortOptionIsGiven() throws ProjectReposito
assertTrue(result.indexOf("Zebra") < result.indexOf("Apple"));
}

@Test
void shouldKeepCreationOrderWhenNoneIsTypedAsTheSortValue() throws ProjectRepository.NameTakenException {
// Given projects are created out of alphabetical and score order
projectService.createProject("Zebra", "Created first", 1, 1, 1, 1, 1);
projectService.createProject("Apple", "Created second", 5, 5, 5, 5, 1);

// When the user types --sort none, in a capitalization other than the default's
var result = listProjectsCommand.execute("NONE");

// Then it is accepted like an omitted --sort: creation order under the unqualified header
assertFalse(result.contains("Invalid sort option"));
assertTrue(result.startsWith("Projects:\n"));
assertTrue(result.indexOf("Zebra") < result.indexOf("Apple"));
}

@Test
void shouldSortByNameWhenNameSortIsRequested() throws ProjectRepository.NameTakenException {
// Given projects are created out of alphabetical order
Expand Down
Loading