-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit-checker: move to an importable dir
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
- Loading branch information
1 parent
329a666
commit eaa9fc2
Showing
7 changed files
with
59 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
commitchecker/config.go → commitchecker/commitchecker/config.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package commitchecker | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package commitchecker | ||
|
||
import ( | ||
"bytes" | ||
|
2 changes: 1 addition & 1 deletion
2
commitchecker/git_test.go → commitchecker/commitchecker/git_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package commitchecker | ||
|
||
import ( | ||
"testing" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package commitchecker | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
) | ||
|
||
type FetchMode string | ||
|
||
const ( | ||
HTTPS FetchMode = "https" | ||
SSH FetchMode = "ssh" | ||
) | ||
|
||
type Options struct { | ||
Start string | ||
End string | ||
ConfigFile string | ||
FetchMode string | ||
} | ||
|
||
func DefaultOptions() Options { | ||
return Options{ | ||
Start: "main", | ||
End: "HEAD", | ||
ConfigFile: "./commitchecker.yaml", | ||
FetchMode: string(HTTPS), | ||
} | ||
} | ||
|
||
func (o *Options) Bind(fs *flag.FlagSet) { | ||
fs.StringVar(&o.Start, "start", o.Start, "The start of the revision range for analysis") | ||
fs.StringVar(&o.End, "end", o.End, "The end of the revision range for analysis") | ||
fs.StringVar(&o.ConfigFile, "config", o.ConfigFile, "The configuration file to use (optional).") | ||
fs.StringVar(&o.FetchMode, "fetch-mode", o.FetchMode, "Method to use for fetching from git remotes.") | ||
} | ||
|
||
func (o *Options) Validate() error { | ||
switch FetchMode(o.FetchMode) { | ||
case SSH, HTTPS: | ||
default: | ||
return fmt.Errorf("--fetch-mode must be one of %v", []FetchMode{HTTPS, SSH}) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
commitchecker/validate_test.go → commitchecker/commitchecker/validate_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package commitchecker | ||
|
||
import ( | ||
"reflect" | ||
|