forked from toolshed/abra
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			783 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			783 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package recipe
 | |
| 
 | |
| import (
 | |
| 	"coopcloud.tech/abra/cli/internal"
 | |
| 	"coopcloud.tech/abra/pkg/autocomplete"
 | |
| 	gitPkg "coopcloud.tech/abra/pkg/git"
 | |
| 	"coopcloud.tech/abra/pkg/log"
 | |
| 	"github.com/spf13/cobra"
 | |
| )
 | |
| 
 | |
| var RecipeDiffCommand = &cobra.Command{
 | |
| 	Use:     "diff <recipe> [flags]",
 | |
| 	Aliases: []string{"d"},
 | |
| 	Short:   "Show unstaged changes in recipe config",
 | |
| 	Long:    "This command requires /usr/bin/git.",
 | |
| 	Args:    cobra.MinimumNArgs(1),
 | |
| 	ValidArgsFunction: func(
 | |
| 		cmd *cobra.Command,
 | |
| 		args []string,
 | |
| 		toComplete string) ([]string, cobra.ShellCompDirective) {
 | |
| 		return autocomplete.RecipeNameComplete()
 | |
| 	},
 | |
| 	Run: func(cmd *cobra.Command, args []string) {
 | |
| 		r := internal.ValidateRecipe(args, cmd.Name())
 | |
| 		if err := gitPkg.DiffUnstaged(r.Dir); err != nil {
 | |
| 			log.Fatal(err)
 | |
| 		}
 | |
| 	},
 | |
| }
 |