Skip to content

Commit

Permalink
Use init function to add commands
Browse files Browse the repository at this point in the history
  • Loading branch information
spenserblack committed Apr 13, 2021
1 parent c44db25 commit 29a7e16
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ var Search = &cobra.Command{
},
}

func AddCommands() {
func init() {
RootCmd.AddCommand(Search)
}
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
)

func main() {
cmd.AddCommands()

if err := cmd.RootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
Expand Down

0 comments on commit 29a7e16

Please sign in to comment.