diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 7b1201d..a91f2db 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -23,6 +23,8 @@ jobs: go-version: '1.23' - name: Build Binary + env: + VERSION: ${{ github.ref_name }} run: make all - name: Upload Binary to Generic Registry diff --git a/Makefile b/Makefile index 54f3bd0..b9ca9c9 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,18 @@ CMD_NAME := git-project-manager .PHONY: all test build install docs clean +VERSION ?= development # Default to "development" if VERSION is not set + all: test build install docs test: go test -v ./... build: test - go build -o bin/${CMD_NAME} + go build -ldflags "-X gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd.Version=$(VERSION)" -o bin/${CMD_NAME} install: - go install -v . + go install -v -ldflags "-X gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd.Version=$(VERSION)" . docs: bin/${CMD_NAME} docs md diff --git a/cmd/root.go b/cmd/root.go index 23768a5..07e07cd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -29,8 +29,9 @@ var rootCmd = &cobra.Command{ } var ( - utils *util.Utils + Version = "development" configExemptCommands = regexp.MustCompile(`^(doc|conf)`) + utils *util.Utils ) // Hook traversal is enabled, so this will be run for all @@ -80,6 +81,9 @@ func init() { rootCmd.AddCommand(cache.CacheCmd) rootCmd.AddCommand(conf.ConfigCmd) rootCmd.AddCommand(project.ProjectCmd) + + // Version + rootCmd.Version = Version } // initConfig reads in config file and ENV variables if set. diff --git a/docs/git-project-manager.md b/docs/git-project-manager.md index c770212..3e3ad0e 100644 --- a/docs/git-project-manager.md +++ b/docs/git-project-manager.md @@ -27,4 +27,4 @@ shortcuts for moving around in projects and opening your code * [git-project-manager docs](git-project-manager_docs.md) - Generate documentation for git-project-manager * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_alias.md b/docs/git-project-manager_alias.md index 0f448ba..158a6cb 100644 --- a/docs/git-project-manager_alias.md +++ b/docs/git-project-manager_alias.md @@ -29,4 +29,4 @@ listing, adding, and deleting. * [git-project-manager alias delete](git-project-manager_alias_delete.md) - Delete a project alias * [git-project-manager alias list](git-project-manager_alias_list.md) - List Aliases -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_alias_add.md b/docs/git-project-manager_alias_add.md index 83b5568..2df9bb8 100644 --- a/docs/git-project-manager_alias_add.md +++ b/docs/git-project-manager_alias_add.md @@ -31,4 +31,4 @@ git-project-manager alias add [flags] * [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_alias_delete.md b/docs/git-project-manager_alias_delete.md index 64761ab..9238568 100644 --- a/docs/git-project-manager_alias_delete.md +++ b/docs/git-project-manager_alias_delete.md @@ -31,4 +31,4 @@ git-project-manager alias delete [fuzzy project or alias] [flags] * [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_alias_list.md b/docs/git-project-manager_alias_list.md index 4b72b4c..0ce18e0 100644 --- a/docs/git-project-manager_alias_list.md +++ b/docs/git-project-manager_alias_list.md @@ -29,4 +29,4 @@ git-project-manager alias list [flags] * [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_cache.md b/docs/git-project-manager_cache.md index 6c0d343..2ada70c 100644 --- a/docs/git-project-manager_cache.md +++ b/docs/git-project-manager_cache.md @@ -32,4 +32,4 @@ API every time a new project is added / searched for * [git-project-manager cache load](git-project-manager_cache_load.md) - Load Git Project Cache * [git-project-manager cache unlock](git-project-manager_cache_unlock.md) - unlock Git project cache -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_cache_clear.md b/docs/git-project-manager_cache_clear.md index 4e2792f..937f686 100644 --- a/docs/git-project-manager_cache_clear.md +++ b/docs/git-project-manager_cache_clear.md @@ -33,4 +33,4 @@ git-project-manager cache clear [flags] * [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_cache_dump.md b/docs/git-project-manager_cache_dump.md index 8f13059..6fc9b69 100644 --- a/docs/git-project-manager_cache_dump.md +++ b/docs/git-project-manager_cache_dump.md @@ -31,4 +31,4 @@ git-project-manager cache dump [flags] * [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_cache_load.md b/docs/git-project-manager_cache_load.md index 86f80f8..38dbc62 100644 --- a/docs/git-project-manager_cache_load.md +++ b/docs/git-project-manager_cache_load.md @@ -33,4 +33,4 @@ git-project-manager cache load [flags] * [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_cache_unlock.md b/docs/git-project-manager_cache_unlock.md index 2b16aca..d9c8582 100644 --- a/docs/git-project-manager_cache_unlock.md +++ b/docs/git-project-manager_cache_unlock.md @@ -31,4 +31,4 @@ git-project-manager cache unlock [flags] * [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_completion.md b/docs/git-project-manager_completion.md index 0027f61..8f21a2d 100644 --- a/docs/git-project-manager_completion.md +++ b/docs/git-project-manager_completion.md @@ -31,4 +31,4 @@ See each sub-command's help for details on how to use the generated script. * [git-project-manager completion powershell](git-project-manager_completion_powershell.md) - Generate the autocompletion script for powershell * [git-project-manager completion zsh](git-project-manager_completion_zsh.md) - Generate the autocompletion script for zsh -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_completion_bash.md b/docs/git-project-manager_completion_bash.md index b04e37f..f3f22e1 100644 --- a/docs/git-project-manager_completion_bash.md +++ b/docs/git-project-manager_completion_bash.md @@ -50,4 +50,4 @@ git-project-manager completion bash * [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_completion_fish.md b/docs/git-project-manager_completion_fish.md index bc15512..309d77b 100644 --- a/docs/git-project-manager_completion_fish.md +++ b/docs/git-project-manager_completion_fish.md @@ -41,4 +41,4 @@ git-project-manager completion fish [flags] * [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_completion_powershell.md b/docs/git-project-manager_completion_powershell.md index 31fbf81..66ec18f 100644 --- a/docs/git-project-manager_completion_powershell.md +++ b/docs/git-project-manager_completion_powershell.md @@ -38,4 +38,4 @@ git-project-manager completion powershell [flags] * [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_completion_zsh.md b/docs/git-project-manager_completion_zsh.md index 2212675..a0d1936 100644 --- a/docs/git-project-manager_completion_zsh.md +++ b/docs/git-project-manager_completion_zsh.md @@ -52,4 +52,4 @@ git-project-manager completion zsh [flags] * [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_config.md b/docs/git-project-manager_config.md index 55e6326..aab96b6 100644 --- a/docs/git-project-manager_config.md +++ b/docs/git-project-manager_config.md @@ -28,4 +28,4 @@ useful for seeding a new config file * [git-project-manager config generate](git-project-manager_config_generate.md) - Generate a default configuration * [git-project-manager config show](git-project-manager_config_show.md) - Show Git Project Manager Configuration -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_config_generate.md b/docs/git-project-manager_config_generate.md index 7bb459d..4a28f9e 100644 --- a/docs/git-project-manager_config_generate.md +++ b/docs/git-project-manager_config_generate.md @@ -32,4 +32,4 @@ git-project-manager config generate [flags] * [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_config_show.md b/docs/git-project-manager_config_show.md index 449d68e..911572e 100644 --- a/docs/git-project-manager_config_show.md +++ b/docs/git-project-manager_config_show.md @@ -26,4 +26,4 @@ git-project-manager config show [flags] * [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_docs.md b/docs/git-project-manager_docs.md index 817240a..1bf243b 100644 --- a/docs/git-project-manager_docs.md +++ b/docs/git-project-manager_docs.md @@ -26,4 +26,4 @@ git-project-manager docs [flags] * [git-project-manager](git-project-manager.md) - Find and use Git projects locally -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project.md b/docs/git-project-manager_project.md index 5718a21..15fa36c 100644 --- a/docs/git-project-manager_project.md +++ b/docs/git-project-manager_project.md @@ -35,4 +35,4 @@ the project locally. * [git-project-manager project show](git-project-manager_project_show.md) - Show detail for a Git project * [git-project-manager project show](git-project-manager_project_show.md) - Show detail for a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_add.md b/docs/git-project-manager_project_add.md index 838cecf..4c8692b 100644 --- a/docs/git-project-manager_project_add.md +++ b/docs/git-project-manager_project_add.md @@ -30,4 +30,4 @@ git-project-manager project add [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_go.md b/docs/git-project-manager_project_go.md index 541e59d..3764968 100644 --- a/docs/git-project-manager_project_go.md +++ b/docs/git-project-manager_project_go.md @@ -33,4 +33,4 @@ git-project-manager project go [fuzzy alias search] [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_list.md b/docs/git-project-manager_project_list.md index 8863325..211ea6e 100644 --- a/docs/git-project-manager_project_list.md +++ b/docs/git-project-manager_project_list.md @@ -31,4 +31,4 @@ git-project-manager project list [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_open.md b/docs/git-project-manager_project_open.md index 80d8fdb..58f096f 100644 --- a/docs/git-project-manager_project_open.md +++ b/docs/git-project-manager_project_open.md @@ -36,4 +36,4 @@ git-project-manager project open [fuzzy alias search] [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_run.md b/docs/git-project-manager_project_run.md index 06749c1..18b70ed 100644 --- a/docs/git-project-manager_project_run.md +++ b/docs/git-project-manager_project_run.md @@ -30,4 +30,4 @@ git-project-manager project run [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024 diff --git a/docs/git-project-manager_project_show.md b/docs/git-project-manager_project_show.md index 9c4a9e3..66712de 100644 --- a/docs/git-project-manager_project_show.md +++ b/docs/git-project-manager_project_show.md @@ -31,4 +31,4 @@ git-project-manager project show [fuzzy alias search] [flags] * [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 30-Dec-2024 +###### Auto generated by spf13/cobra on 31-Dec-2024