forked from toolshed/abra
		
	feat: add dryflag, implement push for catalogue generate
This commit is contained in:
		@ -63,6 +63,7 @@ var catalogueGenerateCommand = &cli.Command{
 | 
				
			|||||||
		internal.PushFlag,
 | 
							internal.PushFlag,
 | 
				
			||||||
		internal.CommitFlag,
 | 
							internal.CommitFlag,
 | 
				
			||||||
		internal.CommitMessageFlag,
 | 
							internal.CommitMessageFlag,
 | 
				
			||||||
 | 
							internal.DryFlag,
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	Description: `
 | 
						Description: `
 | 
				
			||||||
This command generates a new copy of the recipe catalogue which can be found on:
 | 
					This command generates a new copy of the recipe catalogue which can be found on:
 | 
				
			||||||
@ -233,7 +234,7 @@ A new catalogue copy can be published to the recipes repository by passing the
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if err := gitPkg.Commit("**.json", internal.CommitMessage, false); err != nil {
 | 
								if err := gitPkg.Commit("**.json", internal.CommitMessage, internal.Dry, internal.Push); err != nil {
 | 
				
			||||||
				logrus.Fatal(err)
 | 
									logrus.Fatal(err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -155,7 +155,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
 | 
				
			|||||||
				logrus.Fatal("no commit message specified?")
 | 
									logrus.Fatal("no commit message specified?")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if err := gitPkg.Commit("compose.**yml", internal.CommitMessage, internal.Dry); err != nil {
 | 
								if err := gitPkg.Commit("compose.**yml", internal.CommitMessage, internal.Dry, false); err != nil {
 | 
				
			||||||
				logrus.Fatal(err)
 | 
									logrus.Fatal(err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Commit runs a git commit
 | 
					// Commit runs a git commit
 | 
				
			||||||
func Commit(glob, commitMessage string, dryRun bool) error {
 | 
					func Commit(glob, commitMessage string, dryRun, push bool) error {
 | 
				
			||||||
	if commitMessage == "" {
 | 
						if commitMessage == "" {
 | 
				
			||||||
		return fmt.Errorf("no commit message specified?")
 | 
							return fmt.Errorf("no commit message specified?")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -55,7 +55,7 @@ func Commit(glob, commitMessage string, dryRun bool) error {
 | 
				
			|||||||
		logrus.Info("dry run: no changes commited")
 | 
							logrus.Info("dry run: no changes commited")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !dryRun {
 | 
						if !dryRun && push {
 | 
				
			||||||
		if err := commitRepo.Push(&git.PushOptions{}); err != nil {
 | 
							if err := commitRepo.Push(&git.PushOptions{}); err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user