All checks were successful
continuous-integration/drone/push Build is passing
See #483
31 lines
847 B
Go
31 lines
847 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/i18n"
|
|
"coopcloud.tech/abra/pkg/log"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var RecipeDiffCommand = &cobra.Command{
|
|
Use: i18n.G("diff <recipe> [flags]"),
|
|
Aliases: []string{i18n.G("d")},
|
|
Short: i18n.G("Show unstaged changes in recipe config"),
|
|
Long: i18n.G("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)
|
|
}
|
|
},
|
|
}
|