Skip to content

Commit

Permalink
fix: keep compatible with v3 series
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 committed May 7, 2024
1 parent c1d2d7b commit 1375269
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cmd/idea_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
"github.com/murphysecurity/murphysec/utils"
"github.com/murphysecurity/murphysec/utils/must"
"github.com/spf13/cobra"
"os"
"path/filepath"
"slices"

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / test

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (linux, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (darwin, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (darwin, arm64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (linux, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / test

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (darwin, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (darwin, arm64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)

Check failure on line 14 in cmd/idea_scan.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64)

package slices is not in GOROOT (/opt/hostedtoolcache/go/1.19.2/x64/src/slices)
"strings"
)

func ideaScanCmd() *cobra.Command {
Expand Down Expand Up @@ -44,9 +47,16 @@ func ideaScanCmd() *cobra.Command {
}
c.Flags().StringVar(&dir, "dir", "", "project base dir")
c.Flags().StringVar(&env.Scope, "scope", "", "")
c.Args = cobra.NoArgs
must.Must(c.MarkFlagRequired("dir"))
must.Must(c.MarkFlagDirname("dir"))
// compatible with recently version
var indexOfIDEASCAN = slices.Index(os.Args, "ideascan")
if indexOfIDEASCAN > -1 && len(os.Args) > indexOfIDEASCAN+1 && !strings.HasPrefix(os.Args[indexOfIDEASCAN+1], "-") {
dir = os.Args[indexOfIDEASCAN+1]
c.Args = cobra.ExactArgs(1)
} else {
c.Args = cobra.NoArgs
must.Must(c.MarkFlagRequired("dir"))
must.Must(c.MarkFlagDirname("dir"))
}
c.Flags().StringVar(&ProjectId, "project-id", "", "team id")
c.Flags().StringVar(&env.GradleProjects, "gradle-projects", "", "")
return c
Expand Down

0 comments on commit 1375269

Please sign in to comment.