Skip to content

Commit

Permalink
Revert "allow passing of commit hash on the cli" (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
noqcks authored Jan 24, 2024
1 parent b7ce660 commit 89899aa
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 134 deletions.
30 changes: 1 addition & 29 deletions cmd/xeol/cli/options/xeol.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
git "github.com/go-git/go-git/v5"
"github.com/karrick/tparse"

"github.com/xeol-io/xeol/cmd/xeol/internal/types"
"github.com/xeol-io/xeol/internal/format"
)

Expand Down Expand Up @@ -100,11 +99,6 @@ func (o *Xeol) AddFlags(flags clio.FlagSet) {
"manually set the name of the project being analyzed for xeol.io. If you are running xeol inside a git repository, this will be automatically detected.",
)

flags.StringVarP(&o.CommitHash,
"commit-hash", "",
"manually set the commit hash of the project being analyzed for xeol.io. If you are running xeol inside a git repository, this will be automatically detected.",
)

flags.StringVarP(&o.APIKey,
"api-key", "",
"set the API key for xeol.io. When this is set, scans will be uploaded to xeol.io.",
Expand Down Expand Up @@ -155,28 +149,6 @@ func (o *Xeol) parseLookaheadOption() (err error) {
return nil
}

func (o *Xeol) parseProjectAndCommitOption() (err error) {
if o.APIKey != "" {
if o.ProjectName == "" {
return fmt.Errorf("must specify a project name when using --api-key. This is usually inferred automatically when running inside a git repository, but you may also pass it manually with --project-name")
}
if err := types.ProjectName(o.ProjectName).IsValid(); err != nil {
return err
}

if o.CommitHash == "" {
return fmt.Errorf("must specify a commit hash when using --api-key. This is usually inferred automatically when running inside a git repository, but you may also pass it manually with --commit-hash")
}
if err := types.CommitHash(o.CommitHash).IsValid(); err != nil {
return err
}
}
return nil
}

func (o *Xeol) PostLoad() error {
if err := o.parseLookaheadOption(); err != nil {
return err
}
return o.parseProjectAndCommitOption()
return o.parseLookaheadOption()
}
16 changes: 0 additions & 16 deletions cmd/xeol/internal/types/commit.go

This file was deleted.

27 changes: 0 additions & 27 deletions cmd/xeol/internal/types/commit_test.go

This file was deleted.

16 changes: 0 additions & 16 deletions cmd/xeol/internal/types/projectname.go

This file was deleted.

46 changes: 0 additions & 46 deletions cmd/xeol/internal/types/projectname_test.go

This file was deleted.

0 comments on commit 89899aa

Please sign in to comment.