Skip to content

docs: document table default for multi-value options in cli:option docstring - #83

Open
Tieske with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-docstring-for-cli-option
Open

docs: document table default for multi-value options in cli:option docstring#83
Tieske with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-docstring-for-cli-option

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The cli:option default parameter docstring typed the argument as {bool} and only described scalar defaults — silently omitting the table form that enables multi-value collection. This is the primary place users and generated API docs reference, making the feature effectively invisible there despite being in the README and test suite.

Changes

  • src/cliargs/core.luacli:option @param default:
    • Type annotation: {bool}{string|table}
    • Added description of table behaviour: passing a table makes the option accumulate values across invocations; pre-populated entries are the default list
-- Passing a table enables multi-value collection:
cli:option('--tag=VALUE', 'one or more tags', {})
-- cli --tag foo --tag bar  →  args["tag"] == { "foo", "bar" }

-- Pre-populated entries act as defaults when the option is never supplied:
cli:option('--compress=VALUE', 'compression algorithm', { 'lzma' })
-- cli  →  args["compress"] == { "lzma" }

fixes #70

Copilot AI requested a review from Tieske August 2, 2026 07:33
@Tieske
Tieske marked this pull request as ready for review August 2, 2026 08:00
@Tieske
Tieske requested a review from alerque August 2, 2026 08:02

@Tieske Tieske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Option to accept multiple options not documented

2 participants