Adds ability to specify files to be applied positionally, as well as … #5388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds ability to specify files to be applied positionally, as well as by flags for ruletypes, profiles and data sources.
Fixes #5383
Change Type
Mark the type of change your PR introduces:
Testing
Ruletype
Usage updated:
minder ruletype apply [files...] [flags]
Error updated:
Details: no files specified: use positional arguments or the -f flag
Single Positional argument
Cmd: minder ruletype apply osps-ac-02.yaml
Works as expected - ADDED
Multiple positional arguments
Cmd: minder ruletype apply osps-ac-02.yaml osps-ac-03.yaml
Works as expected - ADDED
Multiple positional arguments
ruletype apply osps-{ac-02,ac-03}.yaml
Works as expected - ADDED
All of these scenarios were also tested with project flag (-j) before and after the positional arguments.
Single positional argument, invalid file
Message: Error expanding file args
Details: error getting file info: stat sdfd.yaml: no such file or directory
Multiple positional arguments, invalid file + valid file
Message: Error expanding file args
Details: error getting file info: stat sdfd.yaml: no such file or directory
Single flag (regression test)
Cmd: minder ruletype apply -f osps-ac-02.yaml
Works as expected - SAME AS PREVIOUSLY
Multiple flags (regression test)
Cmd: minder ruletype apply -f osps-ac-02.yaml -f osps-ac-03.yaml
Works as expected - SAME AS PREVIOUSLY
Multiple flag arguments
ruletype apply -f osps-{ac-02,ac-03}.yaml
Works as expected - FIXED
Profile
Usage updated:
minder profile apply [file] [flags]
Error updated:
Details: file is required - provide as argument or via --file flag
Single flag (regression test)
Cmd: minder profile apply -f test-profile.yaml
Works as expected - SAME AS PREVIOUSLY
Single positional argument
Cmd: minder profile apply test-profile.yaml
Works as expected - ADDED
Datasource
Usage updated:
minder datasource apply [files...] [flags]
Error updated:
Details: no files specified: use positional arguments or the -f flag
Single positional argument
Cmd: minder datasource apply -f data-sources/osv.yaml
Works as expected - ADDED
Multiple positional arguments
Cmd: minder datasource apply /data-sources/{openssf_bestpractices,osv}.yaml
Works as expected - ADDED
Single flag (regression test)
Works as expected - SAME AS PREVIOUSLY
Review Checklist: