Registry Mirror
Skip to content

Conversation

@divyani-22

@divyani-22 divyani-22 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

In cmd/create.go, two usability and input validation issues are addressed:

  1. Path argument conflicts: When users supply both --path flag and a positional argument (e.g. func create -l go --path=/my/dir /other/dir), newCreateConfig previously dropped the positional argument without warning or error. If users passed multiple positional arguments (func create -l go dir1 dir2), extra arguments were discarded. In contrast, other commands like describe and delete fail fast on contradictory inputs.
  2. Case sensitivity for runtime and template names: func create -l Go or -l PYTHON failed with newInvalidRuntimeError, and func create -l go -t HTTP failed with newInvalidTemplateError, because validation performed strict literal case matching (v == runtime) against lowercase canonical names (go, python, http, etc.). Normalizing with strings.ToLower and comparing with strings.EqualFold provides consistent case-insensitivity.

Changes

  • cmd/create.go:
    • Enforced mutual exclusion between --path flag and positional argument (cannot specify both --path and a positional argument).
    • Added check rejecting multiple positional arguments (accepts at most 1 positional argument [path]).
    • Normalized --language and --template inputs using strings.ToLower(strings.TrimSpace(...)) in createConfig.
    • Updated isValidRuntime and isValidTemplate to use strings.EqualFold for case-insensitive validation.
  • cmd/create_test.go:
    • Added TestCreate_PathAndPositionalConflict verifying that conflicting --path and positional arguments are rejected.
    • Added TestCreate_MultiplePositionalArgs verifying that extra positional arguments are rejected.
    • Added TestCreate_CaseInsensitiveRuntime testing mixed-case and uppercase runtime names (Go, GO, Python, PYTHON, Node).
    • Added TestCreate_CaseInsensitiveTemplate testing mixed-case and uppercase template names (HTTP, Http, CloudEvents, cloudevents).

Testing

  • TestCreate_PathAndPositionalConflict in cmd/create_test.go
  • TestCreate_MultiplePositionalArgs in cmd/create_test.go
  • TestCreate_CaseInsensitiveRuntime in cmd/create_test.go
  • TestCreate_CaseInsensitiveTemplate in cmd/create_test.go

Copilot AI balanced review requested due to automatic review settings November 29, 2026 16:22
@knative-prow

knative-prow Bot commented Nov 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: divyani-22
Once this PR has been reviewed and has the lgtm label, please assign dsimansk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the size/M 🤖 PR changes 30-99 lines, ignoring generated files. label Nov 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label Nov 29, 2026
@knative-prow

knative-prow Bot commented Nov 29, 2026

Copy link
Copy Markdown

Hi @divyani-22. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@divyani-22
divyani-22 force-pushed the fix/create-path-conflict-and-runtime-case branch from 09005de to bba2d12 Compare November 30, 2026 01:23
…te names

Signed-off-by: Divyani <divyanipapalkar22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants