Skip to content

Commit

Permalink
Clean up arg parsing
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs committed Sep 4, 2024
1 parent 70c2f16 commit 4484e63
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bincapz.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ func main() {
}

// when scanning, increment the slice index by one to account for flags
scanPaths := c.Args().Slice()[1:]
if slices.Contains(c.Args().Slice(), "scan") {
scanPaths = c.Args().Slice()[2:]
args := c.Args().Slice()
scanPaths := args[1:]
if slices.Contains(args, "scan") {
scanPaths = args[2:]
}

bc = bincapz.Config{
Expand Down Expand Up @@ -379,7 +380,8 @@ func main() {
case c.String("image") != "":
bc.OCI = true
case c.String("image") == "" || c.String("path") == "":
bc.ScanPaths = []string{c.Args().Slice()[0]}
cmdArgs := c.Args().Slice()
bc.ScanPaths = []string{cmdArgs[0]}
}

res, err = action.Scan(ctx, bc)
Expand Down

0 comments on commit 4484e63

Please sign in to comment.