Skip to content

Commit

Permalink
Added gitlab amend although it is not yet fully working.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Schinkel committed Oct 25, 2022
1 parent c27d0e0 commit c66f694
Show file tree
Hide file tree
Showing 27 changed files with 806 additions and 578 deletions.
38 changes: 38 additions & 0 deletions cmd/amend.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package cmd

import (
"context"
"fmt"

"github.com/ribice/glice/v3/pkg"
"github.com/ribice/glice/v3/pkg/gllicscan"
"github.com/spf13/cobra"
)

// amendCmd represents the amend command
var amendCmd = &cobra.Command{
Use: "amend",
Run: RunReportAmend,
Short: fmt.Sprintf("Amend a report to file in %s, %s or %s format", glice.TableFormat, glice.JSONFormat, glice.CSVFormat),
}

func init() {
gitLabCmd.AddCommand(amendCmd)
amendCmd.Flags().String("path", glice.SourceDir(), "Directory path were license scanning report can be found")
amendCmd.Flags().String("filename", gllicscan.ReportFilename, "JSON file to amend containing results of license scan on GitLab")
}

//goland:noinspection GoUnusedParameter
func RunReportAmend(cmd *cobra.Command, args []string) {
NoteBegin()
Notef("\nAmending license scanning report")
ctx := context.Background()
toAmend := LoadJSONReportFromGitLab(cmd)
deps := ScanDependencies(ctx)
pf := LoadProjectFile(ctx)
gr := glice.NewGitLabReport(deps, pf.Overrides)
toAmend.Amend(gr)
SaveJSONReportForGitLab(ctx, toAmend)
Notef("\nReport amended")
NoteEnd()
}
15 changes: 15 additions & 0 deletions cmd/gitlab.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package cmd

import (
"github.com/spf13/cobra"
)

// gitLabCmd represents the gitLab command
var gitLabCmd = &cobra.Command{
Use: "gitlab",
Short: "Commands with sub-commands specific to GitLab",
}

func init() {
rootCmd.AddCommand(gitLabCmd)
}
7 changes: 4 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"

"github.com/ribice/glice/v3/pkg"
"github.com/spf13/cobra"
)
Expand All @@ -25,11 +26,11 @@ func init() {

//goland:noinspection GoUnusedParameter
func RunInit(cmd *cobra.Command, args []string) {
ctx := context.Background()
NoteBegin()
Notef("\nInitializing %s for project", glice.AppName)
pf := CreatingProjectFile(ctx)
ctx := context.Background()
pf := CreateProjectFile(ctx)
pf.Dependencies = ScanDependencies(ctx)
SavingProjectFile(ctx, pf)
SaveProjectFile(ctx, pf)
NoteEnd()
}
5 changes: 3 additions & 2 deletions cmd/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package cmd
import (
"context"
"fmt"
glice "github.com/ribice/glice/v3/pkg"

"github.com/ribice/glice/v3/pkg"
"github.com/spf13/cobra"
)

Expand All @@ -26,7 +27,7 @@ func init() {

//goland:noinspection GoUnusedParameter
func RunLicenses(cmd *cobra.Command, args []string) {
dir := glice.Flag(cmd, "path")
dir := Flag(cmd, "path")
ctx := context.Background()

NoteBegin()
Expand Down
Loading

0 comments on commit c66f694

Please sign in to comment.