Compare commits
No commits in common. "main" and "avoid-project-id-collisions" have entirely different histories.
main
...
avoid-proj
@ -9,7 +9,6 @@ env:
|
|||||||
BINARY_NAME: git-project-manager
|
BINARY_NAME: git-project-manager
|
||||||
GO_MOD_PATH: gitea.libretechconsulting.com/rmcguire/git-project-manager
|
GO_MOD_PATH: gitea.libretechconsulting.com/rmcguire/git-project-manager
|
||||||
GO_GIT_HOST: gitea.libretechconsulting.com
|
GO_GIT_HOST: gitea.libretechconsulting.com
|
||||||
PLATFORMS: linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@ -24,29 +23,22 @@ jobs:
|
|||||||
go-version: '1.23'
|
go-version: '1.23'
|
||||||
|
|
||||||
- name: Build Binary
|
- name: Build Binary
|
||||||
env:
|
|
||||||
VERSION: ${{ github.ref_name }}
|
|
||||||
run: make all
|
run: make all
|
||||||
|
|
||||||
- name: Upload Binaries to Generic Registry
|
- name: Upload Binary to Generic Registry
|
||||||
env:
|
env:
|
||||||
API_TOKEN: ${{ secrets.API_TOKEN }}
|
API_TOKEN: ${{ secrets.API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
for platform in $PLATFORMS; do
|
echo "Pushing ./$BINARY_PATH/$BINARY_NAME to ${GITHUB_SERVER_URL} packages for ${GITHUB_REPOSITORY_OWNER} as ${PACKAGE_NAME}@${{ github.ref_name }}"
|
||||||
OS=$(echo $platform | cut -d/ -f1)
|
if [ -f ./${BINARY_PATH}/${BINARY_NAME} ]; then
|
||||||
ARCH=$(echo $platform | cut -d/ -f2)
|
curl -X PUT \
|
||||||
BINARY_FILE="${BINARY_PATH}/${PACKAGE_NAME}-${OS}-${ARCH}"
|
-H "Authorization: token ${API_TOKEN}" \
|
||||||
echo "Uploading $BINARY_FILE"
|
--upload-file ./${BINARY_PATH}/${BINARY_NAME} \
|
||||||
if [ -f "$BINARY_FILE" ]; then
|
"${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/${PACKAGE_NAME}/${{ github.ref_name }}/${BINARY_NAME}"
|
||||||
curl -X PUT \
|
else
|
||||||
-H "Authorization: token ${API_TOKEN}" \
|
echo "Error: Binary ./${BINARY_PATH}/${BINARY_NAME} not found."
|
||||||
--upload-file "$BINARY_FILE" \
|
exit 1
|
||||||
"${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/${PACKAGE_NAME}/${{ github.ref_name }}/${PACKAGE_NAME}-${OS}-${ARCH}"
|
fi
|
||||||
else
|
|
||||||
echo "Error: Binary $BINARY_FILE not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Generate and Upload Package to Go Registry
|
- name: Generate and Upload Package to Go Registry
|
||||||
env:
|
env:
|
||||||
|
17
Makefile
17
Makefile
@ -2,29 +2,16 @@ CMD_NAME := git-project-manager
|
|||||||
|
|
||||||
.PHONY: all test build install docs clean
|
.PHONY: all test build install docs clean
|
||||||
|
|
||||||
VERSION ?= development # Default to "development" if VERSION is not set
|
|
||||||
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
|
|
||||||
OUTPUT_DIR := bin
|
|
||||||
PKG := gitea.libretechconsulting.com/rmcguire/git-project-manager
|
|
||||||
|
|
||||||
all: test build install docs
|
all: test build install docs
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
|
|
||||||
build: test
|
build: test
|
||||||
@echo "Building for platforms: $(PLATFORMS)"
|
go build -o bin/${CMD_NAME}
|
||||||
@for platform in $(PLATFORMS); do \
|
|
||||||
OS=$$(echo $$platform | cut -d/ -f1); \
|
|
||||||
ARCH=$$(echo $$platform | cut -d/ -f2); \
|
|
||||||
OUTPUT="$(OUTPUT_DIR)/$(CMD_NAME)-$$OS-$$ARCH"; \
|
|
||||||
GOOS=$$OS GOARCH=$$ARCH go build -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" -o $$OUTPUT; \
|
|
||||||
echo "Built $$OUTPUT"; \
|
|
||||||
done
|
|
||||||
go build -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" -o bin/${CMD_NAME}
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
go install -v -ldflags "-X $(PKG)/cmd.Version=$(VERSION)" .
|
go install -v .
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
bin/${CMD_NAME} docs md
|
bin/${CMD_NAME} docs md
|
||||||
|
39
README.md
39
README.md
@ -8,36 +8,6 @@ and shortcuts.
|
|||||||
|
|
||||||
This supports GitHub, GitLab, and Gitea remotes.
|
This supports GitHub, GitLab, and Gitea remotes.
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install git-project-manager using `go`:
|
|
||||||
`go install -v gitea.libretechconsulting.com/rmcguire/git-project-manager@latest`
|
|
||||||
|
|
||||||
OR Download a pre-built binary:
|
|
||||||
[https://gitea.libretechconsulting.com/rmcguire/-/packages/generic/git-project-manager](https://gitea.libretechconsulting.com/rmcguire/-/packages/generic/git-project-manager)
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
**Generate a new config file:**
|
|
||||||
`git-project-manager config generate --write`
|
|
||||||
|
|
||||||
**For handy aliases and shell helpers:**
|
|
||||||
- Download `https://gitea.libretechconsulting.com/rmcguire/git-project-manager/raw/branch/main/contrib/gpm_func_omz.zsh`
|
|
||||||
- Implement however you like (e.g. copy to ~/.oh-my-zsh/custom/)
|
|
||||||
|
|
||||||
For just completion only, source completions from git-project-manager (e.g. for zsh, `source <(git-project-manager completion zsh)`)
|
|
||||||
|
|
||||||
_The following commands assume you've loaded the gpm alias and help funcs._
|
|
||||||
|
|
||||||
**Index your git repos**
|
|
||||||
`gpm cache load`
|
|
||||||
|
|
||||||
**Add your first project**
|
|
||||||
`padd` (gpm project add)
|
|
||||||
|
|
||||||
**Go to your project, fuzzily**
|
|
||||||
`pgo`
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
[Full documentation is available in docs/](./docs/git-project-manager.md)
|
[Full documentation is available in docs/](./docs/git-project-manager.md)
|
||||||
@ -70,6 +40,15 @@ The basic workflow looks like this:
|
|||||||
1. **List** -- get a list of your configured projects any time with `plist`
|
1. **List** -- get a list of your configured projects any time with `plist`
|
||||||
1. **Reward** -- buy the author a beer, because this thing is a time saver
|
1. **Reward** -- buy the author a beer, because this thing is a time saver
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
1. Install into your go path by running `go install .`
|
||||||
|
1. Copy `contrib/gpm_func_omz.zsh` into your `~/.oh-my-zsh/custom/` path, or just source from your bashrc/zshrc
|
||||||
|
1. Generate config file: `gpm config gen --write`
|
||||||
|
1. You can run this any time to update settings
|
||||||
|
1. It will only add one Git remote, so update the file for multiple
|
||||||
|
1. Run `gpm cache load` (if aliases is in-place, otherwise `git-project-manager cache load`)
|
||||||
|
|
||||||
### Config Sample
|
### Config Sample
|
||||||
```yaml
|
```yaml
|
||||||
remotes:
|
remotes:
|
||||||
|
14
cmd/root.go
14
cmd/root.go
@ -6,7 +6,6 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
@ -30,9 +29,8 @@ var rootCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Version = "development"
|
|
||||||
configExemptCommands = regexp.MustCompile(`^(doc|conf)`)
|
|
||||||
utils *util.Utils
|
utils *util.Utils
|
||||||
|
configExemptCommands = regexp.MustCompile(`^(doc|conf)`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Hook traversal is enabled, so this will be run for all
|
// Hook traversal is enabled, so this will be run for all
|
||||||
@ -82,9 +80,6 @@ func init() {
|
|||||||
rootCmd.AddCommand(cache.CacheCmd)
|
rootCmd.AddCommand(cache.CacheCmd)
|
||||||
rootCmd.AddCommand(conf.ConfigCmd)
|
rootCmd.AddCommand(conf.ConfigCmd)
|
||||||
rootCmd.AddCommand(project.ProjectCmd)
|
rootCmd.AddCommand(project.ProjectCmd)
|
||||||
|
|
||||||
// Version
|
|
||||||
rootCmd.Version = getVersion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// initConfig reads in config file and ENV variables if set.
|
// initConfig reads in config file and ENV variables if set.
|
||||||
@ -173,10 +168,3 @@ func checkConfigPerms(file string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getVersion() string {
|
|
||||||
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" {
|
|
||||||
return info.Main.Version
|
|
||||||
}
|
|
||||||
return Version
|
|
||||||
}
|
|
||||||
|
@ -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 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
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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 delete](git-project-manager_alias_delete.md) - Delete a project alias
|
||||||
* [git-project-manager alias list](git-project-manager_alias_list.md) - List Aliases
|
* [git-project-manager alias list](git-project-manager_alias_list.md) - List Aliases
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -31,4 +31,4 @@ git-project-manager alias add [flags]
|
|||||||
|
|
||||||
* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases
|
* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -29,4 +29,4 @@ git-project-manager alias list [flags]
|
|||||||
|
|
||||||
* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases
|
* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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 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
|
* [git-project-manager cache unlock](git-project-manager_cache_unlock.md) - unlock Git project cache
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -33,4 +33,4 @@ git-project-manager cache clear [flags]
|
|||||||
|
|
||||||
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -31,4 +31,4 @@ git-project-manager cache dump [flags]
|
|||||||
|
|
||||||
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -33,4 +33,4 @@ git-project-manager cache load [flags]
|
|||||||
|
|
||||||
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -31,4 +31,4 @@ git-project-manager cache unlock [flags]
|
|||||||
|
|
||||||
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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 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
|
* [git-project-manager completion zsh](git-project-manager_completion_zsh.md) - Generate the autocompletion script for zsh
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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 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
|
* [git-project-manager config show](git-project-manager_config_show.md) - Show Git Project Manager Configuration
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -32,4 +32,4 @@ git-project-manager config generate [flags]
|
|||||||
|
|
||||||
* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration
|
* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -26,4 +26,4 @@ git-project-manager config show [flags]
|
|||||||
|
|
||||||
* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration
|
* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -26,4 +26,4 @@ git-project-manager docs [flags]
|
|||||||
|
|
||||||
* [git-project-manager](git-project-manager.md) - Find and use Git projects locally
|
* [git-project-manager](git-project-manager.md) - Find and use Git projects locally
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
||||||
* [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 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -30,4 +30,4 @@ git-project-manager project add [flags]
|
|||||||
|
|
||||||
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -31,4 +31,4 @@ git-project-manager project list [flags]
|
|||||||
|
|
||||||
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -30,4 +30,4 @@ git-project-manager project run [flags]
|
|||||||
|
|
||||||
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
@ -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
|
* [git-project-manager project](git-project-manager_project.md) - Use a Git project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 31-Dec-2024
|
###### Auto generated by spf13/cobra on 30-Dec-2024
|
||||||
|
Loading…
Reference in New Issue
Block a user