diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 834254d..6b6579f 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -16,6 +16,8 @@ jobs: token: ${{ secrets.PAT_TOKEN }} release-type: go package-name: "MageComm" + extra-files: | + version.txt - name: Log release info run: | diff --git a/README.md b/README.md index 79062cc..4d69105 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ config file can be in yaml or json format e.g `config.yml` or `config.json`, ple Download the latest release from the [releases page](https://github.com/furan917/magecomm/releases) for your platform and extract to a directory in your PATH. +Then check your installed version with `magecomm version` + example config.yml: ``` disallow_configfile_overwrite: true diff --git a/main.go b/main.go index 4efa9dc..406b5cf 100644 --- a/main.go +++ b/main.go @@ -1,20 +1,25 @@ package main import ( + _ "embed" + "fmt" "github.com/spf13/cobra" "magecomm/cmd" "magecomm/config_manager" "magecomm/logger" "magecomm/notifictions" "magecomm/services" + "os" "strings" ) +//go:embed version.txt +var version string + var RootCmd = &cobra.Command{ Use: "magecomm", Short: "MageComm CLI is a command line tool for managing Magento applications", PersistentPreRun: func(cmd *cobra.Command, args []string) { - debug, _ := cmd.Flags().GetBool("debug") if debug { logger.EnableDebugMode() @@ -33,11 +38,16 @@ func initializeModuleWhichRequireConfig() { } func main() { + if len(os.Args) > 1 && os.Args[1] == "version" { + fmt.Printf("Magecomm Version: %s\n", strings.TrimSpace(version)) + return + } + RootCmd.AddCommand(cmd.ListenCmd) RootCmd.AddCommand(cmd.MagerunCmd) - //RootCmd.AddCommand(cmd.DeployCmd) RootCmd.AddCommand(cmd.CatCmd) //RootCmd.AddCommand(cmd.CatDeployCmd) + //RootCmd.AddCommand(cmd.DeployCmd) RootCmd.PersistentFlags().String("config", "", "Path to config file") RootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode") diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..f68b119 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +v0.1.10 \ No newline at end of file