Skip to content

Commit 60a279f

Browse files
committed
Bring CLI documentation up to date
Complete the noun-first migration table and remove resolved TODOs. Also describe cross-request partial failures for multi-option updates.
1 parent bf4b5c2 commit 60a279f

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ API response → `parser.Parse[SomethingDto]()` → `dto.Convert()` → `models.
9595

9696
## Testing conventions
9797

98-
- Test files use external test packages: `package printer_test`, `package requests_test`
98+
- Component tests use external test packages (`package printer_test`, `package requests_test`, `package work_packages_test`); cmd-layer tests use internal packages (`package workpackage`) because they exercise unexported command handlers and flag variables
9999
- `TestMain` in `printer_test` initializes shared state (routes, printer) for the package
100100
- Tests use plain `t.Errorf` — no test framework, no assertions library
101-
- Tests only exist for `printer`, `requests`, `common`, and `configuration` — no tests on `cmd/` or `resources/`
101+
- Tests exist for `printer`, `requests`, `common`, `configuration`, `components/resources/work_packages`, and the `cmd/` packages (root, `activity`, `project`, `user`, `workpackage`)
102+
- Regression tests for command/resource behaviour use `httptest` localhost servers and count mutating requests to assert no-mutation guarantees
102103
- When adding a new printer function, add a corresponding test in `components/printer/`
103104
- When adding a new configuration function, add a corresponding test in `components/configuration/`
104105

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ as `op NOUN VERB [additional information]`. You will see plenty of examples with
9696
Earlier releases (up to 0.5.5) used verb-first commands. These have been replaced without aliases;
9797
scripts need to migrate:
9898

99-
| Old (verb-first) | New (noun-first) |
100-
|---------------------------|---------------------------|
101-
| `op list workpackages` | `op work-package list` |
102-
| `op create workpackage` | `op work-package create` |
103-
| `op update workpackage` | `op work-package update` |
104-
| `op inspect workpackage` | `op work-package inspect` |
105-
| `op search workpackages` | `op work-package search` |
106-
| `op list projects` | `op project list` |
107-
| `op list notifications` | `op notification list` |
99+
| Old (verb-first) | New (noun-first) |
100+
|---------------------------|--------------------------------------|
101+
| `op list workpackages` | `op work-package list` |
102+
| `op create workpackage` | `op work-package create` |
103+
| `op update workpackage` | `op work-package update` |
104+
| `op inspect workpackage` | `op work-package inspect` |
105+
| `op search workpackages` | `op work-package search` |
106+
| `op list projects` | `op project list` |
107+
| `op inspect project 42` | `op project inspect 42` |
108+
| `op list notifications` | `op notification list` |
109+
| `op list activities 42` | `op activity list --work-package 42` |
110+
| `op list status` | `op status list` |
111+
| `op list types` | `op type list` |
112+
| `op list timeentries` | `op time-entry list` |
113+
| `op search user X` | `op user search X` |
108114

109115
### Discoverability
110116

@@ -272,9 +278,12 @@ op work-package update 42 --action Claim
272278
op work-package update PROJ-123 --action Claim
273279

274280
# Batch updating some properties of a work package
275-
# Valid input will get processed, while invalid (e.g. wrongly typed) input will get omitted
276281
op work-package update 42 --subject 'The new subject' --type Implementation
277282

283+
# Local inputs are validated before the first change is sent. Each API action
284+
# remains a separate request, so an earlier change may remain if a later
285+
# request fails.
286+
278287
# Uploading an attachment to a work package
279288
op work-package update 42 --attach ./Downloads/Report.pdf
280289
```

TODO.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ Issues identified during code review — non-blocking, to address in future iter
66

77
- [ ] **`op time-entry create --activity` cannot list available activities**`GET /api/v3/time_entries/activities` returns 404 in some OpenProject instances (version or permission issue). Investigate using the form endpoint `GET /api/v3/time_entries/form` which may include allowed activities in its schema.
88

9-
## Project identifier refactoring
10-
11-
- [ ] **`validatedVersionId()` in `cmd/workpackage/list.go` swallows errors** — after `printer.Error(err)` the function continues with a nil `project`/`versions` instead of returning early. Should `return ""` immediately after the error print to avoid fragile control flow.
12-
139
## CLI UX
1410

15-
- [ ] **Add `-w` short flag to `activities --work-package`**`--work-package` has no short option, inconsistent with similar flags elsewhere. Add `-w` or document why it's intentionally omitted.
16-
1711
- [ ] **`--format` flag has no short option** — inconsistent with the convention of adding short flags for frequently used ones. Consider `-f` if it doesn't conflict.

0 commit comments

Comments
 (0)