diff --git a/README.md b/README.md index 89bee7a..62e7b7a 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,6 @@ Prasmoid provides a comprehensive set of commands to manage your plasmoid projec | `regen types` | Regenerates `prasmoid.d.ts`. | `prasmoid regen types` | | `regen config` | Regenerates `prasmoid.config.js`. | `prasmoid regen config` | | `upgrade` | Updates Prasmoid itself to the latest version. | `prasmoid upgrade` | -| `version` | Shows the current version of Prasmoid. | `prasmoid version` | ## Extending Prasmoid with Custom Commands diff --git a/cmd/version/version.go b/cmd/version/version.go deleted file mode 100644 index 4374b85..0000000 --- a/cmd/version/version.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2025 PRAS -*/ -package cmd - -import ( - "fmt" - - "github.com/PRASSamin/prasmoid/cmd" - "github.com/PRASSamin/prasmoid/internal" - "github.com/spf13/cobra" -) - -var CliConfig struct { - Version string `yaml:"version"` - Name string `yaml:"name"` - Author string `yaml:"author"` - License string `yaml:"license"` - Github string `yaml:"github"` -} - -func init() { - cmd.RootCmd.AddCommand(VersionCmd) -} - -var VersionCmd = &cobra.Command{ - Use: "version", - Short: "Show Prasmoid version", - Long: "Show Prasmoid version.", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(internal.AppMetaData.Version) - }, -} diff --git a/cmd/version/version_test.go b/cmd/version/version_test.go deleted file mode 100644 index 7b28d5c..0000000 --- a/cmd/version/version_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package cmd - -import ( - "bytes" - "io" - "os" - "testing" - - "github.com/PRASSamin/prasmoid/internal" - "github.com/stretchr/testify/assert" -) - -func TestVersionCmd(t *testing.T) { - // Capture stdout - oldStdout := os.Stdout - r, w, _ := os.Pipe() - os.Stdout = w - - // Act - VersionCmd.Run(VersionCmd, []string{}) - _ = w.Close() - - // Assert - var buf bytes.Buffer - _, _ = io.Copy(&buf, r) - os.Stdout = oldStdout - assert.Contains(t, buf.String(), internal.AppMetaData.Version) -} diff --git a/update b/update index 1d6c6bf..299c634 100755 --- a/update +++ b/update @@ -22,7 +22,7 @@ if [ -z "$LATEST_RELEASE_INFO" ]; then log_fail "Failed to fetch release info from GitHub." fi -CURRENT_VERSION=$("$CURRENT_EXE" version) +CURRENT_VERSION=$("$CURRENT_EXE" --version) RAW_CURRENT_VERSION=$(echo "$CURRENT_VERSION" | sed "s/-portable//") IS_PORTABLE=false if [[ "$CURRENT_VERSION" == *"-portable"* ]]; then @@ -89,7 +89,7 @@ mv "$TEMP_FILE" "$CURRENT_EXE" log_done "Update complete $LATEST_VERSION ($LATEST_HASH)" -log_step "Relaunching CLI..." -exec "$CURRENT_EXE" +# log_step "Relaunching CLI..." +# exec "$CURRENT_EXE" exit 0 diff --git a/utils/main.go b/utils/main.go index 6c6b880..ce54e03 100644 --- a/utils/main.go +++ b/utils/main.go @@ -364,36 +364,27 @@ func LoadConfigRC() types.Config { data, err := os.ReadFile(configFileName) if err != nil { - color.Yellow("Configuration file (prasmoid.config.js) not found.\n" + - "Run 'prasmoid regen config'\n") return defaultConfig } vm := runtime.NewRuntime() _, err = vm.RunString(string(data)) if err != nil { - color.Yellow("Failed to load configuration file (prasmoid.config.js).\n" + - "Run 'prasmoid regen config'\n") return defaultConfig } config := vm.Get("config") if config == nil { - color.Yellow("Failed to load configuration file (prasmoid.config.js).\n" + - "Run 'prasmoid regen config'\n") return defaultConfig } // Convert to JSON bytes configBytes, err := json.Marshal(config.Export()) if err != nil { - color.Yellow("Failed to load configuration file (prasmoid.config.js).\n" + "Run 'prasmoid regen config'\n") return defaultConfig } // Unmarshal into Config struct var result types.Config if err := json.Unmarshal(configBytes, &result); err != nil { - color.Yellow("Failed to load configuration file (prasmoid.config.js).\n" + - "Run 'prasmoid regen config'\n") return defaultConfig }