From 049ed32e3348ab79ef7442449188cf5ef6038286 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Fri, 27 Sep 2024 11:02:11 -0400 Subject: [PATCH] refactor: extract root command creation to separate file --- cmd/motr/main.go | 7 +------ cmd/motr/root.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 cmd/motr/root.go diff --git a/cmd/motr/main.go b/cmd/motr/main.go index ed4fb66b7..769fceab6 100644 --- a/cmd/motr/main.go +++ b/cmd/motr/main.go @@ -1,12 +1,7 @@ package main -import "github.com/spf13/cobra" - func main() { - rootCmd := &cobra.Command{ - Use: "motr", - Short: "Manage a local DWN instance for the Sonr blockchain", - } + rootCmd := NewRootCmd() rootCmd.AddCommand(NewProxyCmd()) if err := rootCmd.Execute(); err != nil { panic(err) diff --git a/cmd/motr/root.go b/cmd/motr/root.go new file mode 100644 index 000000000..c354214b5 --- /dev/null +++ b/cmd/motr/root.go @@ -0,0 +1,10 @@ +package main + +import "github.com/spf13/cobra" + +func NewRootCmd() *cobra.Command { + return &cobra.Command{ + Use: "motr", + Short: "Manage a local DWN instance for the Sonr blockchain", + } +}