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

feat: support -- arguments for sbom and other extensions [HEAD-861] #4892

Merged
merged 6 commits into from
Oct 5, 2023

Conversation

PeterSchafer
Copy link
Collaborator

@PeterSchafer PeterSchafer commented Oct 4, 2023

What does this PR do?

  • For CLI Extensions, enable accessing arguments passed behind double dash (--)
  • The legacycli Extension is automatically forwarding these arguments to the legacy CLI.

Where should the reviewer start?

  • cmd/cliv2/main.go
  • pkg/basic_workflows/legacycli.go

How should this be manually tested?

Both invocations should give an error that they can't go list "arbitrary content"
snyk sbom cliv2 --format cyclonedx1.4+json -- arbitrary content
snyk test cliv2 -- arbitrary content

Any background context you want to provide?

  • Arguments behind -- are considered positional arguments even if they start with a -
  • They should not interfere with the positional argument used by the CLI to define a folder/package to scan

What are the relevant tickets?

HEAD-861

Screenshots

Additional questions

@PeterSchafer PeterSchafer force-pushed the feat/HEAD-861_support_unknown_args branch from ae3b5ac to 3680867 Compare October 4, 2023 11:43
@PeterSchafer PeterSchafer changed the title chore: introduce support for unknown args (—) feat: support -- arguments for sbom and other extensions [HEAD-861] Oct 4, 2023
@PeterSchafer PeterSchafer marked this pull request as ready for review October 4, 2023 16:13
@PeterSchafer PeterSchafer requested review from a team as code owners October 4, 2023 16:13
@PeterSchafer PeterSchafer force-pushed the feat/HEAD-861_support_unknown_args branch from 96f58f2 to a6b9039 Compare October 4, 2023 16:28
_, err := engine.Invoke(basic_workflows.WORKFLOWID_LEGACY_CLI)
return err
}

func getGlobalFLags() *pflag.FlagSet {
globalConfiguration := workflow.GetGlobalConfiguration()
globalFLags := workflow.FlagsetFromConfigurationOptions(globalConfiguration)
globalConfigurationOptions := workflow.GetGlobalConfiguration()
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): let's rename GetGlobalConfiguration to GetGlobalConfigurationOptions in a follow-up PR.

Copy link
Contributor

@bastiandoetsch bastiandoetsch left a comment

Choose a reason for hiding this comment

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

Works. 🎉

@PeterSchafer PeterSchafer merged commit 3a9dadd into master Oct 5, 2023
5 checks passed
@PeterSchafer PeterSchafer deleted the feat/HEAD-861_support_unknown_args branch October 5, 2023 07:09
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.

3 participants