feat(app): make -json opt-in via App.JSON (v1.3.0)
App now registers -json only when App.JSON is true, so a CLI whose commands do not use cli.Emit never advertises a flag it cannot honor. Driven by the first real consumer (evpnc), whose commands print text directly and are not yet converted to Emit. The example opts in (JSON: true). Backward-additive: existing App users that want -json set JSON: true. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| **Status** | Describes shipped behavior as of `v1.2.0` |
|
||||
| **Status** | Describes shipped behavior as of `v1.3.0` |
|
||||
| **Author** | Pim van Pelt `<pim@ipng.ch>` |
|
||||
| **Last updated** | 2026-06-05 |
|
||||
| **Audience** | Contributors, and authors of CLIs built on this library |
|
||||
@@ -95,8 +95,9 @@ or JSON from the same code.
|
||||
|
||||
**FR-5 `App` entry point**
|
||||
|
||||
- **FR-5.1** `App` MUST register `-color`, `-json`, `-version`, and `-server`
|
||||
(only when a server is configured).
|
||||
- **FR-5.1** `App` MUST register `-color` and `-version`; `-server` only when a
|
||||
server is configured; and `-json` only when the app opts in (its commands use
|
||||
`Emit`), so a CLI never advertises a flag it cannot honor.
|
||||
- **FR-5.2** `App` MUST NOT dial anything; the client is built in a caller's
|
||||
`Connect` callback.
|
||||
- **FR-5.3** `-version` MUST print and exit without connecting.
|
||||
|
||||
Reference in New Issue
Block a user