Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve CLI parsing for Image Args #1072

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

chews93319
Copy link
Contributor

@chews93319 chews93319 commented Aug 25, 2024

Issue #, if available: Resolves #827

Description of changes:

Evaluate CLI args according to positional group.
<args_before_options><option_args><image_name><image_args>

This change introduces:

  • Initial scan to identify the position of <option_args>
  • Handling cases for various Flag permutations
  • Function to handle various Flag&Argument permutations
  • Pass through handling for Image and Image Arguments
  • Associated Unit Test updates for new nerdctl output standards

Testing done:

  • Successful make test-unit & make test-e2e
  • manual testing with permutations of the commands listed below
./_output/bin/finch --debug container run -it --name="myContainer" -e "E=v" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug container run -it --name="myContainer" -e"E=v" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug container run -it --name="myContainer" --env="E=v" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug container run -it --name="myContainer" --env-file=temp.env --rm busybox echo -e "hello\tbye"

./_output/bin/finch --debug container run -it --env-file=temp.env --rm busybox env
./_output/bin/finch --debug container run -it --env="E=v" --rm busybox env
./_output/bin/finch --debug container run -it -e "E=v" --rm busybox env
./_output/bin/finch --debug container run -it -e"E=v" --rm busybox env

./_output/bin/finch --debug run -it -e"E=v" --rm busybox env
./_output/bin/finch --debug run -it -e "E=v" --rm busybox env
./_output/bin/finch --debug run -it --env="E=v" --rm busybox env
./_output/bin/finch --debug run -it --env-file=temp.env --rm busybox env

./_output/bin/finch --debug run -it --env-file=temp.env --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug run -it --env="E=v" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug run -it -e "E=v" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug run -it -e"E=v" --rm busybox echo -e "hello\tbye" env

./_output/bin/finch --debug run -it -e"USER" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug run -it -e "USER" --rm busybox echo -e "hello\tbye"
./_output/bin/finch --debug run -it --env="USER" --rm busybox echo -e "hello\tbye"
  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@chews93319 chews93319 force-pushed the arg_parsing branch 30 times, most recently from 26a986a to 06b62c4 Compare August 29, 2024 14:51
e2e/vm/soci_test.go Outdated Show resolved Hide resolved
cmd/finch/nerdctl.go Outdated Show resolved Hide resolved
@chews93319 chews93319 force-pushed the arg_parsing branch 2 times, most recently from a1f55f2 to 8548be8 Compare August 30, 2024 06:12
cmd/finch/nerdctl.go Outdated Show resolved Hide resolved
@chews93319 chews93319 force-pushed the arg_parsing branch 4 times, most recently from 4d4cffc to b22b70f Compare August 31, 2024 06:03
Resolves runfinch#827

Evaluate CLI args according to positional group.
<args_before_options><option_args><image_name><image_args>

Signed-off-by: Sam Chew <[email protected]>
@chews93319 chews93319 merged commit 6d49ac7 into runfinch:main Sep 3, 2024
22 checks passed
@chews93319 chews93319 deleted the arg_parsing branch September 3, 2024 23:20
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.

Unable to use the "--env" option on finch container run
3 participants