From 1aa6723ec3fce22531e6ad61f93a5c7aedac12c1 Mon Sep 17 00:00:00 2001 From: kardolus Date: Wed, 6 Nov 2024 23:05:12 +0100 Subject: [PATCH] chore: update file paths for resources --- README.md | 2 +- cmd/chatgpt/main.go | 8 ++++---- .../chatgpt/resources}/chatgpt-cli.tape | 0 {resources => cmd/chatgpt/resources}/vhs.gif | Bin {resources/testdata => test/data}/completions.json | 0 {resources/testdata => test/data}/error.json | 0 {resources/testdata => test/data}/history.json | 0 {resources/testdata => test/data}/models.json | 0 test/integration/integration_test.go | 4 ++-- test/utils.go | 4 ++-- 10 files changed, 9 insertions(+), 9 deletions(-) rename {resources => cmd/chatgpt/resources}/chatgpt-cli.tape (100%) rename {resources => cmd/chatgpt/resources}/vhs.gif (100%) rename {resources/testdata => test/data}/completions.json (100%) rename {resources/testdata => test/data}/error.json (100%) rename {resources/testdata => test/data}/history.json (100%) rename {resources/testdata => test/data}/models.json (100%) diff --git a/README.md b/README.md index e1514ab..3b37806 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ChatGPT CLI provides a powerful command-line interface for seamless interaction with ChatGPT models via OpenAI and Azure, featuring streaming capabilities and extensive configuration options. -![a screenshot](resources/vhs.gif) +![a screenshot](cmd/chatgpt/resources/vhs.gif) ## Table of Contents diff --git a/cmd/chatgpt/main.go b/cmd/chatgpt/main.go index 29fe30e..d8b922a 100644 --- a/cmd/chatgpt/main.go +++ b/cmd/chatgpt/main.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/kardolus/chatgpt-cli/api/client" "github.com/kardolus/chatgpt-cli/api/http" - utils2 "github.com/kardolus/chatgpt-cli/cmd/chatgpt/utils" + "github.com/kardolus/chatgpt-cli/cmd/chatgpt/utils" "github.com/kardolus/chatgpt-cli/internal" "github.com/spf13/pflag" "gopkg.in/yaml.v3" @@ -230,7 +230,7 @@ func run(cmd *cobra.Command, args []string) error { } if cmd.Flag("prompt").Changed { - prompt, err := utils2.FileToString(promptFile) + prompt, err := utils.FileToString(promptFile) if err != nil { return err } @@ -278,7 +278,7 @@ func run(cmd *cobra.Command, args []string) error { defer rl.Close() commandPrompt := func(counter, usage int) string { - return utils2.FormatPrompt(c.Config.CommandPrompt, counter, usage, time.Now()) + return utils.FormatPrompt(c.Config.CommandPrompt, counter, usage, time.Now()) } qNum, usage := 1, 0 @@ -291,7 +291,7 @@ func run(cmd *cobra.Command, args []string) error { return nil } - fmtOutputPrompt := utils2.FormatPrompt(c.Config.OutputPrompt, qNum, usage, time.Now()) + fmtOutputPrompt := utils.FormatPrompt(c.Config.OutputPrompt, qNum, usage, time.Now()) if queryMode { result, qUsage, err := c.Query(input) diff --git a/resources/chatgpt-cli.tape b/cmd/chatgpt/resources/chatgpt-cli.tape similarity index 100% rename from resources/chatgpt-cli.tape rename to cmd/chatgpt/resources/chatgpt-cli.tape diff --git a/resources/vhs.gif b/cmd/chatgpt/resources/vhs.gif similarity index 100% rename from resources/vhs.gif rename to cmd/chatgpt/resources/vhs.gif diff --git a/resources/testdata/completions.json b/test/data/completions.json similarity index 100% rename from resources/testdata/completions.json rename to test/data/completions.json diff --git a/resources/testdata/error.json b/test/data/error.json similarity index 100% rename from resources/testdata/error.json rename to test/data/error.json diff --git a/resources/testdata/history.json b/test/data/history.json similarity index 100% rename from resources/testdata/history.json rename to test/data/history.json diff --git a/resources/testdata/models.json b/test/data/models.json similarity index 100% rename from resources/testdata/models.json rename to test/data/models.json diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 4646adf..6cae60a 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -7,7 +7,7 @@ import ( "github.com/kardolus/chatgpt-cli/config" "github.com/kardolus/chatgpt-cli/history" "github.com/kardolus/chatgpt-cli/internal" - utils2 "github.com/kardolus/chatgpt-cli/test" + "github.com/kardolus/chatgpt-cli/test" "github.com/onsi/gomega/gexec" "github.com/sclevine/spec" "github.com/sclevine/spec/report" @@ -580,7 +580,7 @@ func testIntegration(t *testing.T, when spec.G, it spec.S) { historyFile := path.Join(filePath, "history", "default.json") Expect(historyFile).NotTo(BeAnExistingFile()) - bytes, err := utils2.FileToBytes("history.json") + bytes, err := test.FileToBytes("history.json") Expect(err).NotTo(HaveOccurred()) Expect(os.WriteFile(legacyFile, bytes, 0644)).To(Succeed()) diff --git a/test/utils.go b/test/utils.go index 004db49..9835127 100644 --- a/test/utils.go +++ b/test/utils.go @@ -17,9 +17,9 @@ func FileToBytes(fileName string) ([]byte, error) { err error ) if strings.Contains(thisFile, "vendor") { - urlPath, err = filepath.Abs(path.Join(thisFile, "../../../../../..", "resources", "testdata", fileName)) + urlPath, err = filepath.Abs(path.Join(thisFile, "../../../../../..", "test", "data", fileName)) } else { - urlPath, err = filepath.Abs(path.Join(thisFile, "../..", "resources", "testdata", fileName)) + urlPath, err = filepath.Abs(path.Join(thisFile, "../..", "test", "data", fileName)) } if err != nil {