diff --git a/config.go b/config.go index b8e4769..e3ceb1e 100644 --- a/config.go +++ b/config.go @@ -13,6 +13,7 @@ type config struct { compare []string benchCmd string benchArgs []string + gitPath string } func newConfig(c *cli.Context) config { @@ -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"), } } diff --git a/main.go b/main.go index 8991570..84d1d80 100644 --- a/main.go +++ b/main.go @@ -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: ".", + }, }, } @@ -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) }