Skip to content

Remove invalid required=True from click.argument with nargs=-1#17

Merged
ioggstream merged 3 commits into
ioggstream-14from
copilot/sub-pr-15
Jan 8, 2026
Merged

Remove invalid required=True from click.argument with nargs=-1#17
ioggstream merged 3 commits into
ioggstream-14from
copilot/sub-pr-15

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 8, 2026

The @click.argument decorator was using required=True with nargs=-1, creating a semantic conflict—nargs=-1 means "0 or more" while required=True implies "at least 1". Click's argument class accepts the required parameter, but using it with variadic arguments is non-idiomatic.

Changes:

  • Removed required=True from @click.argument decorator
  • Added explicit validation in function body using click.UsageError
  • Added required=True to --output option to prevent None value errors

Before:

@click.command()
@click.argument("files", nargs=-1, type=click.Path(exists=True), required=True)
@click.option("--output", "-o", help="Output markdown file")
def main(files, output):
    output_md = Path(output)  # output can be None
    # ...

After:

@click.command()
@click.argument("files", nargs=-1, type=click.Path(exists=True))
@click.option("--output", "-o", required=True, help="Output markdown file")
def main(files, output):
    if not files:
        raise click.UsageError("At least one file is required")
    output_md = Path(output)  # output is guaranteed non-None
    # ...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 8, 2026 17:26
Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>
Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address feedback on pyscript bump PR Remove invalid required=True from click.argument with nargs=-1 Jan 8, 2026
Copilot AI requested a review from ioggstream January 8, 2026 17:30
@ioggstream ioggstream marked this pull request as ready for review January 8, 2026 17:38
@ioggstream ioggstream merged commit 445f6ac into ioggstream-14 Jan 8, 2026
@ioggstream ioggstream deleted the copilot/sub-pr-15 branch January 8, 2026 17:38
ioggstream added a commit that referenced this pull request Jan 8, 2026
* Fix placement of Service and Deployment in Namespace.

* Preliminary bump pyscript.

* Remove invalid required=True from click.argument with nargs=-1 (#17)

* Initial plan

* Fix click.argument usage by removing required=True and adding validation

Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>

* Add required=True to --output option to prevent None value

Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ioggstream <1140844+ioggstream@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants