Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed: New arg for specify git path #27

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type config struct {
compare []string
benchCmd string
benchArgs []string
gitPath string
}

func newConfig(c *cli.Context) config {
Expand All @@ -23,5 +24,6 @@ func newConfig(c *cli.Context) config {
compare: strings.Split(c.String("compare"), ","),
benchCmd: c.String("bench-cmd"),
benchArgs: strings.Fields(c.String("bench-args")),
gitPath: c.String("git-path"),
}
}
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ func main() {
Usage: "Specify arguments passed to -cmd",
Value: "test -run '^$' -bench . -benchmem ./...",
},
&cli.StringFlag{
Name: "git-path",
Usage: "Specify the path of the git repo",
Value: ".",
},
},
}

Expand All @@ -76,7 +81,7 @@ func main() {
}

func run(c config) error {
r, err := git.PlainOpen(".")
r, err := git.PlainOpen(c.gitPath)
if err != nil {
return xerrors.Errorf("unable to open the git repository: %w", err)
}
Expand Down