diff --git a/lmcli.go b/lmcli.go new file mode 100644 index 0000000..48eee6c --- /dev/null +++ b/lmcli.go @@ -0,0 +1,16 @@ +package main + +import ( + "fmt" + "os" + + "git.mlow.ca/mlow/lmcli/pkg/cli" +) + +func main() { + lmcli := cli.NewRootCmd() + if err := lmcli.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} diff --git a/main.go b/pkg/cli/cmd.go similarity index 97% rename from main.go rename to pkg/cli/cmd.go index 6881c00..1d9e874 100644 --- a/main.go +++ b/pkg/cli/cmd.go @@ -1,4 +1,4 @@ -package main +package cli import ( "fmt" @@ -133,10 +133,7 @@ var promptCmd = &cobra.Command{ }, } -func main() { +func NewRootCmd() *cobra.Command { rootCmd.AddCommand(newCmd, promptCmd) - if err := rootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } + return rootCmd; } diff --git a/config.go b/pkg/cli/config.go similarity index 99% rename from config.go rename to pkg/cli/config.go index 71e94a8..21c3ca7 100644 --- a/config.go +++ b/pkg/cli/config.go @@ -1,4 +1,4 @@ -package main +package cli import ( "fmt" diff --git a/openai.go b/pkg/cli/openai.go similarity index 99% rename from openai.go rename to pkg/cli/openai.go index b142de9..4d90bf6 100644 --- a/openai.go +++ b/pkg/cli/openai.go @@ -1,4 +1,4 @@ -package main +package cli import ( "context" diff --git a/store.go b/pkg/cli/store.go similarity index 99% rename from store.go rename to pkg/cli/store.go index 182ae3b..500da1e 100644 --- a/store.go +++ b/pkg/cli/store.go @@ -1,4 +1,4 @@ -package main +package cli import ( "database/sql" diff --git a/util.go b/pkg/cli/util.go similarity index 98% rename from util.go rename to pkg/cli/util.go index 27ce1a1..641449b 100644 --- a/util.go +++ b/pkg/cli/util.go @@ -1,4 +1,4 @@ -package main +package cli import ( "os"