feat(repo): add support for branch, commit, & tag (#2494)

Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Shubham Palriwala
2022-07-17 16:24:28 +05:30
committed by GitHub
parent 783e7cfe0c
commit 30c9f90bf8
22 changed files with 242 additions and 11 deletions

View File

@@ -51,6 +51,7 @@ type Flags struct {
LicenseFlagGroup *LicenseFlagGroup
MisconfFlagGroup *MisconfFlagGroup
RemoteFlagGroup *RemoteFlagGroup
RepoFlagGroup *RepoFlagGroup
ReportFlagGroup *ReportFlagGroup
SBOMFlagGroup *SBOMFlagGroup
ScanFlagGroup *ScanFlagGroup
@@ -68,6 +69,7 @@ type Options struct {
LicenseOptions
MisconfOptions
RemoteOptions
RepoOptions
ReportOptions
SBOMOptions
ScanOptions
@@ -209,6 +211,9 @@ func (f *Flags) groups() []FlagGroup {
if f.RemoteFlagGroup != nil {
groups = append(groups, f.RemoteFlagGroup)
}
if f.RepoFlagGroup != nil {
groups = append(groups, f.RepoFlagGroup)
}
return groups
}
@@ -302,6 +307,10 @@ func (f *Flags) ToOptions(appVersion string, args []string, globalFlags *GlobalF
opts.RemoteOptions = f.RemoteFlagGroup.ToOptions()
}
if f.RepoFlagGroup != nil {
opts.RepoOptions = f.RepoFlagGroup.ToOptions()
}
if f.ReportFlagGroup != nil {
opts.ReportOptions, err = f.ReportFlagGroup.ToOptions(output)
if err != nil {