Skip to content

Commit

Permalink
call command from main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerjh committed Apr 25, 2022
1 parent bcae197 commit f0f8f8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
14 changes: 0 additions & 14 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"os"

"github.com/spf13/cobra"
)

Expand All @@ -13,22 +11,10 @@ func RootCmd() *cobra.Command {
Long: `This application is used to generate JSON Schemas from YAML or JSON files.
For more information, see genjsonschema-cli create --help
`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
}
command.AddCommand(
generateCreateCommand(),
)
return command

}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := RootCmd().Execute()
if err != nil {
os.Exit(1)
}
}
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package main

import "github.com/holgerjh/genjsonschema-cli/cmd"
import (
"os"

"github.com/holgerjh/genjsonschema-cli/cmd"
)

func main() {
cmd.Execute()
err := cmd.RootCmd().Execute()
if err != nil {
os.Exit(1)
}
}

0 comments on commit f0f8f8a

Please sign in to comment.