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

flexibility on overriding config values #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmd/assemble.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ Advanced Example:

ctx := logger.WithLogger(context.Background())

configPath, _ := cmd.Flags().GetString("configPath")
name, _ := cmd.Flags().GetString("name")
version, _ := cmd.Flags().GetString("version")
typeValue, _ := cmd.Flags().GetString("type")

if configPath == "" {
// if no config file, all grouped flags are required
if name == "" || version == "" || typeValue == "" {
return fmt.Errorf("if no config file is provided, flags --name, --version, and --type must all be set")
}
}

assembleParams, err := extractArgs(cmd, args)
if err != nil {
return err
Expand All @@ -78,7 +90,6 @@ func init() {
assembleCmd.Flags().StringP("name", "n", "", "name of the assembled sbom")
assembleCmd.Flags().StringP("version", "v", "", "version of the assembled sbom")
assembleCmd.Flags().StringP("type", "t", "", "product type of the assembled sbom (application, framework, library, container, device, firmware)")
assembleCmd.MarkFlagsRequiredTogether("name", "version", "type")

assembleCmd.Flags().BoolP("flatMerge", "f", false, "flat merge")
assembleCmd.Flags().BoolP("hierMerge", "m", false, "hierarchical merge")
Expand Down