Skip to content

Commit

Permalink
add goit initialization check (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 26, 2023
1 parent d2cc8f4 commit 1259b11
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions cmd/diff.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
*/
package cmd

Expand All @@ -13,28 +12,20 @@ import (
// diffCmd represents the diff command
var diffCmd = &cobra.Command{
Use: "diff",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
Short: "show changes between commits, commit and working tree, etc",
Long: "show changes between commits, commit and working tree, etc",
PreRunE: func(cmd *cobra.Command, args []string) error {
if client.RootGoitPath == "" {
return ErrGoitNotInitialized
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("diff called")
return nil
},
}

func init() {
rootCmd.AddCommand(diffCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// diffCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// diffCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

0 comments on commit 1259b11

Please sign in to comment.