diff --git a/errors/error.go b/errors/error.go index 717ddb5..2cce26e 100644 --- a/errors/error.go +++ b/errors/error.go @@ -13,5 +13,4 @@ func Check_Err(err error) { fmt.Println(err) } } - return } diff --git a/go.mod b/go.mod index 266c181..ad61e8e 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/charmbracelet/bubbles v0.18.0 github.com/charmbracelet/bubbletea v0.25.0 github.com/charmbracelet/lipgloss v0.10.0 - github.com/joho/godotenv v1.5.1 github.com/spf13/cobra v1.8.0 golang.org/x/term v0.20.0 ) diff --git a/go.sum b/go.sum index 18ae687..5c1cb46 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,6 @@ github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:Yyn github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= -github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= diff --git a/lib/cli/prompt.go b/lib/cli/prompt.go index 6460cb3..6557a42 100644 --- a/lib/cli/prompt.go +++ b/lib/cli/prompt.go @@ -10,6 +10,7 @@ import ( "github.com/charmbracelet/bubbles/list" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" + "github.com/urizennnn/express-cli/errors" "github.com/urizennnn/express-cli/lib/functions/config" ) @@ -194,7 +195,8 @@ func Skip() config.User { os.Exit(1) } var lines config.User - json.Unmarshal(contents, &lines) + err = json.Unmarshal(contents, &lines) + errors.Check_Err(err) return lines } diff --git a/lib/cmd/init.go b/lib/cmd/init.go index 857b52d..a16f73f 100644 --- a/lib/cmd/init.go +++ b/lib/cmd/init.go @@ -19,7 +19,8 @@ var initCmd = &cobra.Command{ if len(args) == 0 { errors.Check_Err(Err.New(config.Red + "No arguments provided" + config.Reset)) errors.Check_Err(Err.New(config.Red + "Turning off generators..." + config.Reset)) - cmd.Help() + err := cmd.Help() + errors.Check_Err(err) time.Sleep(3 * time.Second) return } diff --git a/lib/functions/config/helper.go b/lib/functions/config/helper.go index 980efd4..9832c14 100644 --- a/lib/functions/config/helper.go +++ b/lib/functions/config/helper.go @@ -5,6 +5,12 @@ import ( "encoding/json" "errors" "fmt" + "github.com/charmbracelet/bubbles/spinner" + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" + Err "github.com/urizennnn/express-cli/errors" + "github.com/urizennnn/express-cli/lib/process" + "golang.org/x/term" "os" "os/signal" "path/filepath" @@ -12,16 +18,8 @@ import ( "sync" "syscall" "time" - - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" - "github.com/urizennnn/express-cli/lib/process" - "golang.org/x/term" ) -var quitTextStyle = lipgloss.NewStyle().Margin(1, 0, 2, 4) - type errMsg error type model struct { @@ -79,7 +77,8 @@ func Run(cwd, DirName, manager, language string) int { go func() { defer wg.Done() defer cancel() - process.CopyFilesToCWD(cwd, DirName, manager, language, cancel) + err := process.CopyFilesToCWD(cwd, DirName, manager, language, cancel) + Err.Check_Err(err) }() wg.Add(1) diff --git a/main.go b/main.go index e5c19c0..c10d8b8 100644 --- a/main.go +++ b/main.go @@ -1,12 +1,9 @@ package main import ( - "github.com/joho/godotenv" "github.com/urizennnn/express-cli/lib/cmd" ) func main() { - godotenv.Load() - cmd.Execute() }