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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ While the examples show a simple command, the schema is designed to handle enter

## Schema Reference

All CLI definitions must be nested under a top-level `cli` object. This root object is mandatory and serves as the container for all commands, arguments, and options that define your command-line interface. While other properties can exist alongside the `cli` object, they will not be validated by the schema.
> [!IMPORTANT]
> All CLI definitions must be nested under a top-level `cli` object. This root object is mandatory and serves as the container for all commands, arguments, and options that define your command-line interface. While other properties can exist alongside the `cli` object, they will not be validated by the schema.

### The `cli` Object

Expand Down Expand Up @@ -176,11 +177,11 @@ The `cli-schema` defines the structure for your CLI definition file. Here are th
| `required` | `boolean` | Whether the option is required. Defaults to `false`. |
| `short` | `string` | The single-letter short alias (e.g., `p`). Must be `^[a-zA-Z]$`. |
| `type` | `string` | The data type. Can be `string`, `number`, `boolean`. |
| `variadic` | `boolean` | Whether the option can accept multiple values. Defaults to `false`. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

With the removal of the variadic property, the method for defining an option that accepts multiple values is no longer obvious. To improve clarity for users of the schema, especially given this is a breaking change, I recommend adding a note to the documentation.

For instance, you could enhance the description of the arguments property within the option object's table to explain that a variadic argument should now be used to accept multiple values. This would make the transition smoother for users.


### The `default` Object

The `default` object is used to define a default value for an `argument` or `option`. It must have exactly one of the following properties:
> [!IMPORTANT]
> The `default` object is used to define a default value for an `argument` or `option`. It must have exactly one of the following properties:

| Property | Type | Description |
| ------------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
Expand Down
1 change: 0 additions & 1 deletion schema/cli.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"short": { "type": "string", "pattern": "^[a-zA-Z]$" },
"description": { "type": "string" },
"type": { "enum": ["string", "number", "boolean"] },
"variadic": { "type": "boolean" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing variadic from options introduces a feature regression regarding choices. Previously, a variadic option could have its values constrained by a choices array. The new approach would be to use an option with a variadic argument. However, the argument definition does not have a choices property.

This means it's no longer possible to enforce that multiple values for an option come from a predefined set. Was this intentional? If not, I'd recommend adding a choices property to the argument definition to restore this functionality.

"required": { "type": "boolean" },
"choices": {
"type": "array",
Expand Down