cmd

package
v0.0.0-...-ec18ef4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "reviewer",
	Short: "Code review your pull requests",
	Long: `By running reviewer your repo's pull requests will get merged
according to the configuration file.`,
	Run: func(cmd *cobra.Command, args []string) {
		var C config
		err := viper.Unmarshal(&C)
		if err != nil {
			fmt.Printf("Error parsing configuration %v", err)
			return
		}
		client, err := reviewer.GetClient()
		if err != nil {
			fmt.Printf("Error creating GitHub client %v", err)
			return
		}

		for repoName, repoParams := range C.Repositories {
			if repoParams.Status == false {
				fmt.Printf("- %v/%v Discarded (repo disabled)\n", repoParams.Username, repoName)
				continue
			}
			prInfos, err := reviewer.GetPullRequestInfos(client, repoParams.Username, repoName)
			if err != nil {
				fmt.Printf("Error getting pull request info of repo %v/%v", repoParams.Username, repoName)
				return
			}
			fmt.Printf("+ %v/%v\n", repoParams.Username, repoName)
			for _, prInfo := range prInfos {
				if prInfo.Score >= repoParams.Required {
					fmt.Printf("  + %v MERGE (%v) score %v of %v required\n", prInfo.Number, prInfo.Title, prInfo.Score, repoParams.Required)

				} else {
					fmt.Printf("  - %v NOP   (%v) score %v of %v required\n", prInfo.Number, prInfo.Title, prInfo.Score, repoParams.Required)
				}
			}
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL