From c78c41f56705e659bd2a345eb3b76025522945fb Mon Sep 17 00:00:00 2001 From: Ryan McGuire Date: Fri, 27 Dec 2024 17:42:44 -0500 Subject: [PATCH] Rename project to git-project-manager --- .vscode/launch.json | 10 +++++ README.md | 36 ++++++++-------- cmd/cache.go | 3 +- cmd/cache_clear.go | 2 +- cmd/cache_dump.go | 2 +- cmd/cache_load.go | 4 +- cmd/cache_unlock.go | 2 +- cmd/config.go | 2 +- cmd/config_show.go | 2 +- cmd/docs.go | 4 +- cmd/project.go | 4 +- cmd/project_add.go | 2 +- cmd/project_go.go | 4 +- cmd/project_list.go | 2 +- cmd/project_open.go | 2 +- cmd/project_run.go | 2 +- cmd/project_show.go | 2 +- cmd/root.go | 21 ++++++---- cmd/util_constants.go | 14 ++++--- cmd/util_init.go | 41 ++++++++++++++----- docs/git-project-manager.md | 30 ++++++++++++++ ..._alias.md => git-project-manager_alias.md} | 14 +++---- ...dd.md => git-project-manager_alias_add.md} | 10 ++--- ...md => git-project-manager_alias_delete.md} | 10 ++--- ...t.md => git-project-manager_alias_list.md} | 10 ++--- ..._cache.md => git-project-manager_cache.md} | 20 ++++----- ....md => git-project-manager_cache_clear.md} | 12 +++--- ...p.md => git-project-manager_cache_dump.md} | 12 +++--- ...d.md => git-project-manager_cache_load.md} | 14 +++---- ...md => git-project-manager_cache_unlock.md} | 12 +++--- docs/git-project-manager_completion.md | 34 +++++++++++++++ ...=> git-project-manager_completion_bash.md} | 16 ++++---- ...=> git-project-manager_completion_fish.md} | 14 +++---- ...-project-manager_completion_powershell.md} | 12 +++--- ... => git-project-manager_completion_zsh.md} | 16 ++++---- ...onfig.md => git-project-manager_config.md} | 14 +++---- ...=> git-project-manager_config_generate.md} | 10 ++--- ....md => git-project-manager_config_show.md} | 12 +++--- ...er_docs.md => git-project-manager_docs.md} | 10 ++--- docs/git-project-manager_project.md | 36 ++++++++++++++++ ....md => git-project-manager_project_add.md} | 12 +++--- ...o.md => git-project-manager_project_go.md} | 12 +++--- ...md => git-project-manager_project_list.md} | 12 +++--- ...md => git-project-manager_project_open.md} | 10 ++--- ....md => git-project-manager_project_run.md} | 10 ++--- ...md => git-project-manager_project_show.md} | 12 +++--- docs/gitlab-project-manager.md | 30 -------------- docs/gitlab-project-manager_completion.md | 34 --------------- docs/gitlab-project-manager_project.md | 36 ---------------- internal/cache/cache.go | 13 +++--- internal/remotes/projects/projects_git.go | 2 +- 51 files changed, 353 insertions(+), 309 deletions(-) create mode 100644 docs/git-project-manager.md rename docs/{gitlab-project-manager_alias.md => git-project-manager_alias.md} (53%) rename docs/{gitlab-project-manager_alias_add.md => git-project-manager_alias_add.md} (72%) rename docs/{gitlab-project-manager_alias_delete.md => git-project-manager_alias_delete.md} (70%) rename docs/{gitlab-project-manager_alias_list.md => git-project-manager_alias_list.md} (67%) rename docs/{gitlab-project-manager_cache.md => git-project-manager_cache.md} (52%) rename docs/{gitlab-project-manager_cache_clear.md => git-project-manager_cache_clear.md} (74%) rename docs/{gitlab-project-manager_cache_dump.md => git-project-manager_cache_dump.md} (69%) rename docs/{gitlab-project-manager_cache_load.md => git-project-manager_cache_load.md} (69%) rename docs/{gitlab-project-manager_cache_unlock.md => git-project-manager_cache_unlock.md} (70%) create mode 100644 docs/git-project-manager_completion.md rename docs/{gitlab-project-manager_completion_bash.md => git-project-manager_completion_bash.md} (64%) rename docs/{gitlab-project-manager_completion_fish.md => git-project-manager_completion_fish.md} (64%) rename docs/{gitlab-project-manager_completion_powershell.md => git-project-manager_completion_powershell.md} (67%) rename docs/{gitlab-project-manager_completion_zsh.md => git-project-manager_completion_zsh.md} (65%) rename docs/{gitlab-project-manager_config.md => git-project-manager_config.md} (53%) rename docs/{gitlab-project-manager_config_generate.md => git-project-manager_config_generate.md} (70%) rename docs/{gitlab-project-manager_config_show.md => git-project-manager_config_show.md} (62%) rename docs/{gitlab-project-manager_docs.md => git-project-manager_docs.md} (71%) create mode 100644 docs/git-project-manager_project.md rename docs/{gitlab-project-manager_project_add.md => git-project-manager_project_add.md} (67%) rename docs/{gitlab-project-manager_project_go.md => git-project-manager_project_go.md} (69%) rename docs/{gitlab-project-manager_project_list.md => git-project-manager_project_list.md} (68%) rename docs/{gitlab-project-manager_project_open.md => git-project-manager_project_open.md} (78%) rename docs/{gitlab-project-manager_project_run.md => git-project-manager_project_run.md} (70%) rename docs/{gitlab-project-manager_project_show.md => git-project-manager_project_show.md} (66%) delete mode 100644 docs/gitlab-project-manager.md delete mode 100644 docs/gitlab-project-manager_completion.md delete mode 100644 docs/gitlab-project-manager_project.md diff --git a/.vscode/launch.json b/.vscode/launch.json index 98d1826..87b5782 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,6 +13,16 @@ "--remote", "https://gitea.libretechconsulting.com" ] + }, + { + "name": "Generate Docs", + "type": "delve", + "request": "launch", + "program": "${workspaceFolder}", + "args": [ + "docs", + "md" + ] } ] } diff --git a/README.md b/README.md index bccaf0c..d9102ec 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -# GitLab Project Manager +# Git Project Manager ## Purpose The goal of this utility is to provide a fuzzy-find method of locating, cloning, -and using GitLab projects -- along with your preferred aliases, autocompletion, +and using Git projects -- along with your preferred aliases, autocompletion, and shortcuts. +This supports GitHub, GitLab, and Gitea remotes. + ## Documentation -[Full documentation is available in docs/](./docs/gitlab-project-manager.md) +[Full documentation is available in docs/](./docs/git-project-manager.md) ## Functionality @@ -44,8 +46,8 @@ The basic workflow looks like this: 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 GitLab, so update the file for multiple -1. Run `gpm cache load` (if aliases is in-place, otherwise `gitlab-project-manager cache load`) + 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 ```yaml @@ -81,34 +83,34 @@ Basic usage to prepare your cache, add a project alias (or aliases), and use a p ### Cache Management ```shell -% gitlab-project-manager cache -h +% git-project-manager cache -h Contains sub-commands for managing project cache. -The project cache keeps this speedy, without smashing against the GitLab +The project cache keeps this speedy, without smashing against the Git remote's API every time a new project is added / searched for Usage: - gitlab-project-manager cache [command] + git-project-manager cache [command] Aliases: cache, a, ln Available Commands: - clear Clear GitLab Project Cache - dump Dump GitLab project cache - load Load GitLab Project Cache - unlock unlock GitLab project cache + clear Clear Git Project Cache + dump Dump Git project cache + load Load Git Project Cache + unlock unlock Git project cache Flags: -h, --help help for cache --ttl duration Duration before cache is re-built in go time.Duration format (default 48h0m0s) Global Flags: - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. -Use "gitlab-project-manager cache [command] --help" for more information about a command. +Use "git-project-manager cache [command] --help" for more information about a command. ``` - To update your cache, run `gpm cache load`. You can also specify one or more remotes @@ -119,8 +121,8 @@ Use "gitlab-project-manager cache [command] --help" for more information about a ## TODO - [x] Don't check remote up unless necessary (project list shouldn't require it) -- [ ] Rename to git-project-manager -- [ ] Move module from gitlab.sweetwater.com to github.com/rdmcguire +- [x] Rename to git-project-manager +- [x] Move module to github.com/rdmcguire - [ ] Add flag for clone timeout for large repos - [ ] Add `gpm cache prune` command - [ ] Fix NPE when cache is reset or project for whatever reason leaves an orphaned alias @@ -128,7 +130,7 @@ Use "gitlab-project-manager cache [command] --help" for more information about a - [ ] Update README for shell completion, aliases, usage - [ ] Make a Makefile - [ ] Add git repo status to project go (up-to-date, pending commits, etc..) -- [ ] Build pipeline, and link to gitlab registry for a release binary +- [ ] Build pipeline, and link to registry for a release binary - [ ] Add GitHub remote - [ ] Package for homebrew - [x] Make generic, this is any git remote, not just GitLab diff --git a/cmd/cache.go b/cmd/cache.go index c11a418..c0119f1 100644 --- a/cmd/cache.go +++ b/cmd/cache.go @@ -5,6 +5,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/cache" ) @@ -13,7 +14,7 @@ var projectCache *cache.Cache var cacheCmd = &cobra.Command{ Use: "cache", Aliases: []string{"a", "ln"}, - Short: "Manage GitLab project cache", + Short: "Manage Git project cache", Long: cacheCmdLong, } diff --git a/cmd/cache_clear.go b/cmd/cache_clear.go index e3fdb30..f03bcd4 100644 --- a/cmd/cache_clear.go +++ b/cmd/cache_clear.go @@ -12,7 +12,7 @@ If --clearAliases is provided, will also reset aliases. Use with caution.` var clearCmd = &cobra.Command{ Use: "clear", - Short: "Clear GitLab Project Cache", + Short: "Clear Git Project Cache", PreRun: runCacheCmd, PostRun: postCacheCmd, Long: longDesc, diff --git a/cmd/cache_dump.go b/cmd/cache_dump.go index 21d7e5e..7210038 100644 --- a/cmd/cache_dump.go +++ b/cmd/cache_dump.go @@ -9,7 +9,7 @@ import ( var dumpCmd = &cobra.Command{ Use: "dump", - Short: "Dump GitLab project cache", + Short: "Dump Git project cache", Long: `Dumps cache to display`, PreRun: runCacheCmd, PostRun: postCacheCmd, diff --git a/cmd/cache_load.go b/cmd/cache_load.go index 139c441..33028e0 100644 --- a/cmd/cache_load.go +++ b/cmd/cache_load.go @@ -7,8 +7,8 @@ import ( var loadCmd = &cobra.Command{ Use: "load", - Short: "Load GitLab Project Cache", - Long: `Used to initialize or update a new GitLab cache. With thousands + Short: "Load Git Project Cache", + Long: `Used to initialize or update a new Git cache. With thousands of projects, it would be too much work to hit the API every time a user wants to find a new project.`, PreRun: runCacheCmd, diff --git a/cmd/cache_unlock.go b/cmd/cache_unlock.go index 81adcf5..595b02e 100644 --- a/cmd/cache_unlock.go +++ b/cmd/cache_unlock.go @@ -8,7 +8,7 @@ import ( var unlockCmd = &cobra.Command{ Use: "unlock", - Short: "unlock GitLab project cache", + Short: "unlock Git project cache", Long: `unlocks cache to display`, Run: func(cmd *cobra.Command, args []string) { initProjectCache(cmd, args) diff --git a/cmd/config.go b/cmd/config.go index 037c8ee..262bf37 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -6,7 +6,7 @@ import ( var configCmd = &cobra.Command{ Use: "config", - Short: "GitLab Project Manager Configuration", + Short: "Git Project Manager Configuration", Aliases: []string{"conf"}, Long: configCmdLong, } diff --git a/cmd/config_show.go b/cmd/config_show.go index dce9a2e..e0390be 100644 --- a/cmd/config_show.go +++ b/cmd/config_show.go @@ -10,7 +10,7 @@ import ( var configShowCmd = &cobra.Command{ Use: "show", - Short: "Show GitLab Project Manager Configuration", + Short: "Show Git Project Manager Configuration", Aliases: []string{"s", "dump", "cat", "ls"}, Run: runConfigShowCmd, } diff --git a/cmd/docs.go b/cmd/docs.go index 0a597dd..26b0ae3 100644 --- a/cmd/docs.go +++ b/cmd/docs.go @@ -39,10 +39,10 @@ func runDocsCmd(cmd *cobra.Command, args []string) { } plog.Info("docs generation complete", plog.Args( - "type", args[0], "docsDir", outDir)) + "type", args[0], "docsDir", outDir, "err", err)) } -func prepareDocsDir(cmd *cobra.Command, outDir string) { +func prepareDocsDir(_ *cobra.Command, outDir string) { _, err := os.Stat(outDir) if err != nil { err = os.Mkdir(outDir, 0o755) diff --git a/cmd/project.go b/cmd/project.go index 81745b9..7724603 100644 --- a/cmd/project.go +++ b/cmd/project.go @@ -10,7 +10,7 @@ import ( var projectCmd = &cobra.Command{ Use: "project [fuzzy alias search]", - Short: "Use a GitLab project", + Short: "Use a Git project", Aliases: []string{"proj", "projects", "p"}, Args: cobra.MaximumNArgs(1), ArgAliases: []string{"alias"}, @@ -60,7 +60,7 @@ func init() { rootCmd.AddCommand(projectCmd) } -func mustHaveProjects(cmd *cobra.Command, args []string) { +func mustHaveProjects(cmd *cobra.Command, _ []string) { if len(projectCache.Projects) == 0 { plog.Fatal("No projects to " + cmd.Name() + ", try running cache load") } diff --git a/cmd/project_add.go b/cmd/project_add.go index c189859..5942fbe 100644 --- a/cmd/project_add.go +++ b/cmd/project_add.go @@ -6,7 +6,7 @@ import ( var projectAddCmd = &cobra.Command{ Use: "add", - Short: "Add a new GitLab project", + Short: "Add a new Git project", Aliases: []string{"a", "alias"}, Long: projAddCmdLong, Run: projectAddCmdRun, diff --git a/cmd/project_go.go b/cmd/project_go.go index f401770..60c5e88 100644 --- a/cmd/project_go.go +++ b/cmd/project_go.go @@ -11,7 +11,7 @@ import ( var projectGoCmd = &cobra.Command{ Use: "go [fuzzy alias search]", - Short: "Go to a GitLab project", + Short: "Go to a Git project", Aliases: []string{"goto", "cd"}, Args: cobra.MaximumNArgs(1), ArgAliases: []string{"project"}, @@ -45,7 +45,7 @@ func projectGoCmdRun(cmd *cobra.Command, args []string) { fmt.Fprintln(os.Stderr, project.GetGitInfo()) // This should be read by any source command, for instance - // `cd "$(gitlab-project-manager projects cd somealias)"` + // `cd "$(git-project-manager projects cd somealias)"` fmt.Println(projectCache.GetProjectPath(project)) exec.Command("cd", projectCache.GetProjectPath(project)).Run() } diff --git a/cmd/project_list.go b/cmd/project_list.go index cfbd7c6..79b242d 100644 --- a/cmd/project_list.go +++ b/cmd/project_list.go @@ -9,7 +9,7 @@ import ( var projectListCmd = &cobra.Command{ Use: "list", - Short: "List GitLab Projects", + Short: "List Git Projects", Aliases: []string{"ls", "l"}, Long: projListCmdLong, Run: projectListCmdRun, diff --git a/cmd/project_open.go b/cmd/project_open.go index a34abd3..9d6eb35 100644 --- a/cmd/project_open.go +++ b/cmd/project_open.go @@ -152,7 +152,7 @@ func getEditor(editor string) (string, error) { path, err := getEditorPath(editor) if path != "" && err == nil { if !isEditorExecutable(path) { - err = errors.New("Editor is not executable") + err = errors.New("editor is not executable") } } return path, err diff --git a/cmd/project_run.go b/cmd/project_run.go index 0e29a34..4c8c531 100644 --- a/cmd/project_run.go +++ b/cmd/project_run.go @@ -32,7 +32,7 @@ func projectRunCmdRun(cmd *cobra.Command, args []string) { lang := project.GetLanguage() if lang == nil { - plog.Fatal("GitLab isn't sure what language this project is... can't run.") + plog.Fatal("Git remote isn't sure what language this project is... can't run.") } plog.Debug(fmt.Sprintf("Project is written in %s, %.2f%% coverage", lang.Name, lang.Percentage)) diff --git a/cmd/project_show.go b/cmd/project_show.go index aef9f83..fd90325 100644 --- a/cmd/project_show.go +++ b/cmd/project_show.go @@ -13,7 +13,7 @@ import ( var projectShowCmd = &cobra.Command{ Use: "show [fuzzy alias search]", - Short: "Show detail for a GitLab project", + Short: "Show detail for a Git project", Aliases: []string{"cat", "s"}, Args: cobra.ArbitraryArgs, Long: projShowCmdLong, diff --git a/cmd/root.go b/cmd/root.go index c120cbe..60fac1f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,6 +4,8 @@ import ( "context" "os" "os/signal" + "path/filepath" + "regexp" "strings" "github.com/pterm/pterm" @@ -19,13 +21,15 @@ var ( ) var rootCmd = &cobra.Command{ - Use: "gitlab-project-manager", + Use: "git-project-manager", Aliases: []string{"gpm"}, - Short: "Find and use GitLab projects locally", + Short: "Find and use Git projects locally", Long: rootCmdLong, PersistentPreRun: initRootCmd, } +var configExemptCommands = regexp.MustCompile(`^(doc|conf)`) + // Hook traversal is enabled, so this will be run for all // sub-commands regardless of their registered pre-hooks func initRootCmd(cmd *cobra.Command, args []string) { @@ -40,7 +44,7 @@ func Execute() { err := rootCmd.ExecuteContext(ctx) if err != nil { - pterm.Error.Printfln(pterm.LightYellow("Command failed, " + err.Error())) + pterm.Error.Printfln("%s", pterm.LightYellow("Command failed, "+err.Error())) os.Exit(1) } } @@ -77,10 +81,11 @@ func initConfig() { home, err := os.UserHomeDir() cobra.CheckErr(err) - // Search config in home directory with name ".gitlab-project-manager" (without extension). - viper.AddConfigPath(home + "/.config") + // Search config in home directory with name ".git-project-manager" (without extension). + configPath := filepath.Join(home, ".config") + viper.AddConfigPath(configPath) viper.SetConfigType("yaml") - viper.SetConfigName("gitlab-project-manager") + viper.SetConfigName(getConfigName(configPath)) } viper.AutomaticEnv() @@ -100,13 +105,13 @@ func initConfig() { plog.Error("Failed loading config", plog.Args("err", err)) } - if len(os.Args) > 0 && strings.HasPrefix(os.Args[1], "conf") { + if len(os.Args) > 0 && configExemptCommands.Match([]byte(os.Args[1])) { plog.Debug("Permitting missing config for config sub-command") return } else if conf.ProjectPath == "" { plog.Fatal("Minimal configuration missing, must have projectPath", plog.Args( "do", - "Try running `gitlab-project-manager config default > "+defConfigPath, + "Try running `git-project-manager config default > "+defConfigPath, )) } diff --git a/cmd/util_constants.go b/cmd/util_constants.go index efed5a4..c269bfe 100644 --- a/cmd/util_constants.go +++ b/cmd/util_constants.go @@ -25,9 +25,11 @@ const ( ) const ( - defGitlabHost = "https://gitlab.com" - defLogLevel = "info" - defConfigPath = "~/.config/gitlab-project-manager.yaml" + defGitlabHost = "https://gitlab.com" + defLogLevel = "info" + defConfigPath = "~/.config/git-project-manager.yaml" + configName = "git-project-manager" + legacyConfigName = "gitlab-project-manager" ) const aliasCmdLong = `Manages project aliases, with options for @@ -42,14 +44,14 @@ const aliasDeleteCmdLong = `Deletes aliases from projects project ID can be provided, or will otherwise use fuzzy find` const cacheCmdLong = `Contains sub-commands for managing project cache. -The project cache keeps this speedy, without smashing against the GitLab +The project cache keeps this speedy, without smashing against the Git API every time a new project is added / searched for` -const rootCmdLong = `Finds GitLab projects using fuzzy-find, remembering +const rootCmdLong = `Finds Git projects using fuzzy-find, remembering your chosen term for the project as an alias, and offers helpful shortcuts for moving around in projects and opening your code` -const projCmdLong = `Switches to a GitLab project by name or alias +const projCmdLong = `Switches to a Git project by name or alias If not found, will enter fzf mode. If not cloned, will clone the project locally.` diff --git a/cmd/util_init.go b/cmd/util_init.go index e2fccbf..18aaebb 100644 --- a/cmd/util_init.go +++ b/cmd/util_init.go @@ -1,12 +1,20 @@ +// This file contains init methods that may be used by +// multiple sub-commands. For instance, the cach and projects +// sub-commands both depend on a cache and may both call the initProjectCache +// func from their PersistentPreRun commands package cmd import ( + "fmt" "os" "os/user" "path/filepath" "strings" + "github.com/pterm/pterm" "github.com/spf13/cobra" + "golang.org/x/sys/unix" + "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/cache" "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/config" "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes" @@ -14,15 +22,9 @@ import ( githubremote "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/github" gitlabremote "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/gitlab" "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/remote" - "golang.org/x/sys/unix" ) -// This file contains init methods that may be used by -// multiple sub-commands. For instance, the cach and projects -// sub-commands both depend on a cache and may both call the initProjectCache -// func from their PersistentPreRun commands - -func initProjectCache(cmd *cobra.Command, args []string) { +func initProjectCache(cmd *cobra.Command, _ []string) { var err error plog.Debug("Running pre-run for cacheCmd") conf.Cache.File = conf.ProjectPath + "/.cache.yaml" @@ -80,11 +82,11 @@ func getRemotes(cmd *cobra.Command) *remotes.Remotes { return gitRemotes } -func postProjectCache(cmd *cobra.Command, args []string) { +func postProjectCache(_ *cobra.Command, _ []string) { projectCache.Write() } -func initProjectPath(cmd *cobra.Command, args []string) { +func initProjectPath(_ *cobra.Command, _ []string) { plog.Debug("Running persistent pre-run for rootCmd") var err error if conf.ProjectPath == "" { @@ -98,7 +100,7 @@ func initProjectPath(cmd *cobra.Command, args []string) { _, err = os.Stat(conf.ProjectPath) if err != nil { plog.Error("Failed to stat project path, trying to create", plog.Args("error", err)) - if err := os.MkdirAll(conf.ProjectPath, 0750); err != nil { + if err = os.MkdirAll(conf.ProjectPath, 0o750); err != nil { plog.Error("Failed to create project path", plog.Args("error", err)) os.Exit(1) } @@ -120,3 +122,22 @@ func resolvePath(path string) (string, error) { } return filepath.Abs(path) } + +func getConfigName(configPath string) string { + // Check existing config + for _, ext := range []string{"yml", "yaml"} { + configFile := fmt.Sprintf("%s/%s.%s", configPath, configName, ext) + legacyConfigFile := fmt.Sprintf("%s/%s.%s", configPath, legacyConfigName, ext) + + if _, err := os.Stat(configFile); err == nil { + return configName + } else if _, err := os.Stat(legacyConfigFile); err == nil { + pterm.DefaultLogger.WithWriter(os.Stderr). + Warn(fmt.Sprintf("using legacy config path, suggest using %s/%s.yaml", configPath, configName)) + return legacyConfigName + } + } + + // Nothing found, do what we want + return configName +} diff --git a/docs/git-project-manager.md b/docs/git-project-manager.md new file mode 100644 index 0000000..738c65e --- /dev/null +++ b/docs/git-project-manager.md @@ -0,0 +1,30 @@ +## git-project-manager + +Find and use Git projects locally + +### Synopsis + +Finds Git projects using fuzzy-find, remembering +your chosen term for the project as an alias, and offers helpful +shortcuts for moving around in projects and opening your code + +### Options + +``` + --config string config file (default is ~/.config/git-project-manager.yaml) + -h, --help help for git-project-manager + --logLevel string Default log level -- info, warn, error, debug (default "info") + --projectPath string Sets a path for local clones of projects + --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. +``` + +### SEE ALSO + +* [git-project-manager alias](git-project-manager_alias.md) - Manage project aliases +* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache +* [git-project-manager completion](git-project-manager_completion.md) - Generate the autocompletion script for the specified shell +* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration +* [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 27-Dec-2024 diff --git a/docs/gitlab-project-manager_alias.md b/docs/git-project-manager_alias.md similarity index 53% rename from docs/gitlab-project-manager_alias.md rename to docs/git-project-manager_alias.md index 63ba048..ce5ce4d 100644 --- a/docs/gitlab-project-manager_alias.md +++ b/docs/git-project-manager_alias.md @@ -1,4 +1,4 @@ -## gitlab-project-manager alias +## git-project-manager alias Manage project aliases @@ -16,7 +16,7 @@ listing, adding, and deleting. ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -24,9 +24,9 @@ listing, adding, and deleting. ### SEE ALSO -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally -* [gitlab-project-manager alias add](gitlab-project-manager_alias_add.md) - Add a project alias -* [gitlab-project-manager alias delete](gitlab-project-manager_alias_delete.md) - Delete a project alias -* [gitlab-project-manager alias list](gitlab-project-manager_alias_list.md) - List Aliases +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally +* [git-project-manager alias add](git-project-manager_alias_add.md) - Add 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 -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_alias_add.md b/docs/git-project-manager_alias_add.md similarity index 72% rename from docs/gitlab-project-manager_alias_add.md rename to docs/git-project-manager_alias_add.md index 711059c..bcc77c5 100644 --- a/docs/gitlab-project-manager_alias_add.md +++ b/docs/git-project-manager_alias_add.md @@ -1,4 +1,4 @@ -## gitlab-project-manager alias add +## git-project-manager alias add Add a project alias @@ -8,7 +8,7 @@ Adds a project alias to a project project ID can be provided, or will otherwise use fuzzy find ``` -gitlab-project-manager alias add [flags] +git-project-manager alias add [flags] ``` ### Options @@ -21,7 +21,7 @@ gitlab-project-manager alias add [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager alias add [flags] ### SEE ALSO -* [gitlab-project-manager alias](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_alias_delete.md b/docs/git-project-manager_alias_delete.md similarity index 70% rename from docs/gitlab-project-manager_alias_delete.md rename to docs/git-project-manager_alias_delete.md index c8f6c8f..e5ae2be 100644 --- a/docs/gitlab-project-manager_alias_delete.md +++ b/docs/git-project-manager_alias_delete.md @@ -1,4 +1,4 @@ -## gitlab-project-manager alias delete +## git-project-manager alias delete Delete a project alias @@ -8,7 +8,7 @@ Deletes aliases from projects project ID can be provided, or will otherwise use fuzzy find ``` -gitlab-project-manager alias delete [fuzzy project or alias] [flags] +git-project-manager alias delete [fuzzy project or alias] [flags] ``` ### Options @@ -21,7 +21,7 @@ gitlab-project-manager alias delete [fuzzy project or alias] [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager alias delete [fuzzy project or alias] [flags] ### SEE ALSO -* [gitlab-project-manager alias](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_alias_list.md b/docs/git-project-manager_alias_list.md similarity index 67% rename from docs/gitlab-project-manager_alias_list.md rename to docs/git-project-manager_alias_list.md index a16a39d..097f06c 100644 --- a/docs/gitlab-project-manager_alias_list.md +++ b/docs/git-project-manager_alias_list.md @@ -1,4 +1,4 @@ -## gitlab-project-manager alias list +## git-project-manager alias list List Aliases @@ -7,7 +7,7 @@ List Aliases Lists all aliases by project ``` -gitlab-project-manager alias list [flags] +git-project-manager alias list [flags] ``` ### Options @@ -19,7 +19,7 @@ gitlab-project-manager alias list [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -27,6 +27,6 @@ gitlab-project-manager alias list [flags] ### SEE ALSO -* [gitlab-project-manager alias](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_cache.md b/docs/git-project-manager_cache.md similarity index 52% rename from docs/gitlab-project-manager_cache.md rename to docs/git-project-manager_cache.md index 51e4bb7..ad73377 100644 --- a/docs/gitlab-project-manager_cache.md +++ b/docs/git-project-manager_cache.md @@ -1,11 +1,11 @@ -## gitlab-project-manager cache +## git-project-manager cache -Manage GitLab project cache +Manage Git project cache ### Synopsis Contains sub-commands for managing project cache. -The project cache keeps this speedy, without smashing against the GitLab +The project cache keeps this speedy, without smashing against the Git API every time a new project is added / searched for ### Options @@ -18,7 +18,7 @@ API every time a new project is added / searched for ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -26,10 +26,10 @@ API every time a new project is added / searched for ### SEE ALSO -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally -* [gitlab-project-manager cache clear](gitlab-project-manager_cache_clear.md) - Clear GitLab Project Cache -* [gitlab-project-manager cache dump](gitlab-project-manager_cache_dump.md) - Dump GitLab project cache -* [gitlab-project-manager cache load](gitlab-project-manager_cache_load.md) - Load GitLab Project Cache -* [gitlab-project-manager cache unlock](gitlab-project-manager_cache_unlock.md) - unlock GitLab project cache +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally +* [git-project-manager cache clear](git-project-manager_cache_clear.md) - Clear Git Project Cache +* [git-project-manager cache dump](git-project-manager_cache_dump.md) - Dump 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 -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_cache_clear.md b/docs/git-project-manager_cache_clear.md similarity index 74% rename from docs/gitlab-project-manager_cache_clear.md rename to docs/git-project-manager_cache_clear.md index 0dc61a9..21c73ba 100644 --- a/docs/gitlab-project-manager_cache_clear.md +++ b/docs/git-project-manager_cache_clear.md @@ -1,6 +1,6 @@ -## gitlab-project-manager cache clear +## git-project-manager cache clear -Clear GitLab Project Cache +Clear Git Project Cache ### Synopsis @@ -9,7 +9,7 @@ Used to reset a project cache, forcing it to be rebuilt. If --clearAliases is provided, will also reset aliases. Use with caution. ``` -gitlab-project-manager cache clear [flags] +git-project-manager cache clear [flags] ``` ### Options @@ -22,7 +22,7 @@ gitlab-project-manager cache clear [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -31,6 +31,6 @@ gitlab-project-manager cache clear [flags] ### SEE ALSO -* [gitlab-project-manager cache](gitlab-project-manager_cache.md) - Manage GitLab project cache +* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_cache_dump.md b/docs/git-project-manager_cache_dump.md similarity index 69% rename from docs/gitlab-project-manager_cache_dump.md rename to docs/git-project-manager_cache_dump.md index 904699b..d2524d5 100644 --- a/docs/gitlab-project-manager_cache_dump.md +++ b/docs/git-project-manager_cache_dump.md @@ -1,13 +1,13 @@ -## gitlab-project-manager cache dump +## git-project-manager cache dump -Dump GitLab project cache +Dump Git project cache ### Synopsis Dumps cache to display ``` -gitlab-project-manager cache dump [flags] +git-project-manager cache dump [flags] ``` ### Options @@ -20,7 +20,7 @@ gitlab-project-manager cache dump [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager cache dump [flags] ### SEE ALSO -* [gitlab-project-manager cache](gitlab-project-manager_cache.md) - Manage GitLab project cache +* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_cache_load.md b/docs/git-project-manager_cache_load.md similarity index 69% rename from docs/gitlab-project-manager_cache_load.md rename to docs/git-project-manager_cache_load.md index d57f1f2..44e3612 100644 --- a/docs/gitlab-project-manager_cache_load.md +++ b/docs/git-project-manager_cache_load.md @@ -1,15 +1,15 @@ -## gitlab-project-manager cache load +## git-project-manager cache load -Load GitLab Project Cache +Load Git Project Cache ### Synopsis -Used to initialize or update a new GitLab cache. With thousands +Used to initialize or update a new Git cache. With thousands of projects, it would be too much work to hit the API every time a user wants to find a new project. ``` -gitlab-project-manager cache load [flags] +git-project-manager cache load [flags] ``` ### Options @@ -22,7 +22,7 @@ gitlab-project-manager cache load [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -31,6 +31,6 @@ gitlab-project-manager cache load [flags] ### SEE ALSO -* [gitlab-project-manager cache](gitlab-project-manager_cache.md) - Manage GitLab project cache +* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_cache_unlock.md b/docs/git-project-manager_cache_unlock.md similarity index 70% rename from docs/gitlab-project-manager_cache_unlock.md rename to docs/git-project-manager_cache_unlock.md index 4adbb7f..7444b8e 100644 --- a/docs/gitlab-project-manager_cache_unlock.md +++ b/docs/git-project-manager_cache_unlock.md @@ -1,13 +1,13 @@ -## gitlab-project-manager cache unlock +## git-project-manager cache unlock -unlock GitLab project cache +unlock Git project cache ### Synopsis unlocks cache to display ``` -gitlab-project-manager cache unlock [flags] +git-project-manager cache unlock [flags] ``` ### Options @@ -20,7 +20,7 @@ gitlab-project-manager cache unlock [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager cache unlock [flags] ### SEE ALSO -* [gitlab-project-manager cache](gitlab-project-manager_cache.md) - Manage GitLab project cache +* [git-project-manager cache](git-project-manager_cache.md) - Manage Git project cache -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/git-project-manager_completion.md b/docs/git-project-manager_completion.md new file mode 100644 index 0000000..a144a59 --- /dev/null +++ b/docs/git-project-manager_completion.md @@ -0,0 +1,34 @@ +## git-project-manager completion + +Generate the autocompletion script for the specified shell + +### Synopsis + +Generate the autocompletion script for git-project-manager for the specified shell. +See each sub-command's help for details on how to use the generated script. + + +### Options + +``` + -h, --help help for completion +``` + +### Options inherited from parent commands + +``` + --config string config file (default is ~/.config/git-project-manager.yaml) + --logLevel string Default log level -- info, warn, error, debug (default "info") + --projectPath string Sets a path for local clones of projects + --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. +``` + +### SEE ALSO + +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally +* [git-project-manager completion bash](git-project-manager_completion_bash.md) - Generate the autocompletion script for bash +* [git-project-manager completion fish](git-project-manager_completion_fish.md) - Generate the autocompletion script for fish +* [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 27-Dec-2024 diff --git a/docs/gitlab-project-manager_completion_bash.md b/docs/git-project-manager_completion_bash.md similarity index 64% rename from docs/gitlab-project-manager_completion_bash.md rename to docs/git-project-manager_completion_bash.md index 64a23bf..2dcfe2d 100644 --- a/docs/gitlab-project-manager_completion_bash.md +++ b/docs/git-project-manager_completion_bash.md @@ -1,4 +1,4 @@ -## gitlab-project-manager completion bash +## git-project-manager completion bash Generate the autocompletion script for bash @@ -11,23 +11,23 @@ If it is not installed already, you can install it via your OS's package manager To load completions in your current shell session: - source <(gitlab-project-manager completion bash) + source <(git-project-manager completion bash) To load completions for every new session, execute once: #### Linux: - gitlab-project-manager completion bash > /etc/bash_completion.d/gitlab-project-manager + git-project-manager completion bash > /etc/bash_completion.d/git-project-manager #### macOS: - gitlab-project-manager completion bash > $(brew --prefix)/etc/bash_completion.d/gitlab-project-manager + git-project-manager completion bash > $(brew --prefix)/etc/bash_completion.d/git-project-manager You will need to start a new shell for this setup to take effect. ``` -gitlab-project-manager completion bash +git-project-manager completion bash ``` ### Options @@ -40,7 +40,7 @@ gitlab-project-manager completion bash ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -48,6 +48,6 @@ gitlab-project-manager completion bash ### SEE ALSO -* [gitlab-project-manager completion](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_completion_fish.md b/docs/git-project-manager_completion_fish.md similarity index 64% rename from docs/gitlab-project-manager_completion_fish.md rename to docs/git-project-manager_completion_fish.md index 7db23b1..bba4515 100644 --- a/docs/gitlab-project-manager_completion_fish.md +++ b/docs/git-project-manager_completion_fish.md @@ -1,4 +1,4 @@ -## gitlab-project-manager completion fish +## git-project-manager completion fish Generate the autocompletion script for fish @@ -8,17 +8,17 @@ Generate the autocompletion script for the fish shell. To load completions in your current shell session: - gitlab-project-manager completion fish | source + git-project-manager completion fish | source To load completions for every new session, execute once: - gitlab-project-manager completion fish > ~/.config/fish/completions/gitlab-project-manager.fish + git-project-manager completion fish > ~/.config/fish/completions/git-project-manager.fish You will need to start a new shell for this setup to take effect. ``` -gitlab-project-manager completion fish [flags] +git-project-manager completion fish [flags] ``` ### Options @@ -31,7 +31,7 @@ gitlab-project-manager completion fish [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -39,6 +39,6 @@ gitlab-project-manager completion fish [flags] ### SEE ALSO -* [gitlab-project-manager completion](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_completion_powershell.md b/docs/git-project-manager_completion_powershell.md similarity index 67% rename from docs/gitlab-project-manager_completion_powershell.md rename to docs/git-project-manager_completion_powershell.md index 304142e..c840dec 100644 --- a/docs/gitlab-project-manager_completion_powershell.md +++ b/docs/git-project-manager_completion_powershell.md @@ -1,4 +1,4 @@ -## gitlab-project-manager completion powershell +## git-project-manager completion powershell Generate the autocompletion script for powershell @@ -8,14 +8,14 @@ Generate the autocompletion script for powershell. To load completions in your current shell session: - gitlab-project-manager completion powershell | Out-String | Invoke-Expression + git-project-manager completion powershell | Out-String | Invoke-Expression To load completions for every new session, add the output of the above command to your powershell profile. ``` -gitlab-project-manager completion powershell [flags] +git-project-manager completion powershell [flags] ``` ### Options @@ -28,7 +28,7 @@ gitlab-project-manager completion powershell [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -36,6 +36,6 @@ gitlab-project-manager completion powershell [flags] ### SEE ALSO -* [gitlab-project-manager completion](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_completion_zsh.md b/docs/git-project-manager_completion_zsh.md similarity index 65% rename from docs/gitlab-project-manager_completion_zsh.md rename to docs/git-project-manager_completion_zsh.md index d664106..cc01d68 100644 --- a/docs/gitlab-project-manager_completion_zsh.md +++ b/docs/git-project-manager_completion_zsh.md @@ -1,4 +1,4 @@ -## gitlab-project-manager completion zsh +## git-project-manager completion zsh Generate the autocompletion script for zsh @@ -13,23 +13,23 @@ to enable it. You can execute the following once: To load completions in your current shell session: - source <(gitlab-project-manager completion zsh) + source <(git-project-manager completion zsh) To load completions for every new session, execute once: #### Linux: - gitlab-project-manager completion zsh > "${fpath[1]}/_gitlab-project-manager" + git-project-manager completion zsh > "${fpath[1]}/_git-project-manager" #### macOS: - gitlab-project-manager completion zsh > $(brew --prefix)/share/zsh/site-functions/_gitlab-project-manager + git-project-manager completion zsh > $(brew --prefix)/share/zsh/site-functions/_git-project-manager You will need to start a new shell for this setup to take effect. ``` -gitlab-project-manager completion zsh [flags] +git-project-manager completion zsh [flags] ``` ### Options @@ -42,7 +42,7 @@ gitlab-project-manager completion zsh [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -50,6 +50,6 @@ gitlab-project-manager completion zsh [flags] ### SEE ALSO -* [gitlab-project-manager completion](gitlab-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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_config.md b/docs/git-project-manager_config.md similarity index 53% rename from docs/gitlab-project-manager_config.md rename to docs/git-project-manager_config.md index 6e9384b..8d5ef78 100644 --- a/docs/gitlab-project-manager_config.md +++ b/docs/git-project-manager_config.md @@ -1,6 +1,6 @@ -## gitlab-project-manager config +## git-project-manager config -GitLab Project Manager Configuration +Git Project Manager Configuration ### Synopsis @@ -16,7 +16,7 @@ useful for seeding a new config file ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -24,8 +24,8 @@ useful for seeding a new config file ### SEE ALSO -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally -* [gitlab-project-manager config generate](gitlab-project-manager_config_generate.md) - Generate a default configuration -* [gitlab-project-manager config show](gitlab-project-manager_config_show.md) - Show GitLab Project Manager Configuration +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally +* [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 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_config_generate.md b/docs/git-project-manager_config_generate.md similarity index 70% rename from docs/gitlab-project-manager_config_generate.md rename to docs/git-project-manager_config_generate.md index 3533be8..78d44c5 100644 --- a/docs/gitlab-project-manager_config_generate.md +++ b/docs/git-project-manager_config_generate.md @@ -1,4 +1,4 @@ -## gitlab-project-manager config generate +## git-project-manager config generate Generate a default configuration @@ -8,7 +8,7 @@ Produces yaml to stdout that can be used to seed the configuration file ``` -gitlab-project-manager config generate [flags] +git-project-manager config generate [flags] ``` ### Options @@ -22,7 +22,7 @@ gitlab-project-manager config generate [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -30,6 +30,6 @@ gitlab-project-manager config generate [flags] ### SEE ALSO -* [gitlab-project-manager config](gitlab-project-manager_config.md) - GitLab Project Manager Configuration +* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_config_show.md b/docs/git-project-manager_config_show.md similarity index 62% rename from docs/gitlab-project-manager_config_show.md rename to docs/git-project-manager_config_show.md index e6b98e0..96f390f 100644 --- a/docs/gitlab-project-manager_config_show.md +++ b/docs/git-project-manager_config_show.md @@ -1,9 +1,9 @@ -## gitlab-project-manager config show +## git-project-manager config show -Show GitLab Project Manager Configuration +Show Git Project Manager Configuration ``` -gitlab-project-manager config show [flags] +git-project-manager config show [flags] ``` ### Options @@ -16,7 +16,7 @@ gitlab-project-manager config show [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -24,6 +24,6 @@ gitlab-project-manager config show [flags] ### SEE ALSO -* [gitlab-project-manager config](gitlab-project-manager_config.md) - GitLab Project Manager Configuration +* [git-project-manager config](git-project-manager_config.md) - Git Project Manager Configuration -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_docs.md b/docs/git-project-manager_docs.md similarity index 71% rename from docs/gitlab-project-manager_docs.md rename to docs/git-project-manager_docs.md index 476c4ad..1773093 100644 --- a/docs/gitlab-project-manager_docs.md +++ b/docs/git-project-manager_docs.md @@ -1,9 +1,9 @@ -## gitlab-project-manager docs +## git-project-manager docs Generate documentation for git-project-manager ``` -gitlab-project-manager docs [flags] +git-project-manager docs [flags] ``` ### Options @@ -16,7 +16,7 @@ gitlab-project-manager docs [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -24,6 +24,6 @@ gitlab-project-manager docs [flags] ### SEE ALSO -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/git-project-manager_project.md b/docs/git-project-manager_project.md new file mode 100644 index 0000000..2fd79d4 --- /dev/null +++ b/docs/git-project-manager_project.md @@ -0,0 +1,36 @@ +## git-project-manager project + +Use a Git project + +### Synopsis + +Switches to a Git project by name or alias +If not found, will enter fzf mode. If not cloned, will clone +the project locally. + +### Options + +``` + -h, --help help for project +``` + +### Options inherited from parent commands + +``` + --config string config file (default is ~/.config/git-project-manager.yaml) + --logLevel string Default log level -- info, warn, error, debug (default "info") + --projectPath string Sets a path for local clones of projects + --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. +``` + +### SEE ALSO + +* [git-project-manager](git-project-manager.md) - Find and use Git projects locally +* [git-project-manager project add](git-project-manager_project_add.md) - Add a new Git project +* [git-project-manager project go](git-project-manager_project_go.md) - Go to a Git project +* [git-project-manager project list](git-project-manager_project_list.md) - List Git Projects +* [git-project-manager project open](git-project-manager_project_open.md) - Open project in your IDE +* [git-project-manager project run](git-project-manager_project_run.md) - Run the project (e.g. go run .) +* [git-project-manager project show](git-project-manager_project_show.md) - Show detail for a Git project + +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_add.md b/docs/git-project-manager_project_add.md similarity index 67% rename from docs/gitlab-project-manager_project_add.md rename to docs/git-project-manager_project_add.md index a373577..fd7e53d 100644 --- a/docs/gitlab-project-manager_project_add.md +++ b/docs/git-project-manager_project_add.md @@ -1,6 +1,6 @@ -## gitlab-project-manager project add +## git-project-manager project add -Add a new GitLab project +Add a new Git project ### Synopsis @@ -8,7 +8,7 @@ Adds a new project to the local project path uses fuzzy find to locate the project ``` -gitlab-project-manager project add [flags] +git-project-manager project add [flags] ``` ### Options @@ -20,7 +20,7 @@ gitlab-project-manager project add [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -28,6 +28,6 @@ gitlab-project-manager project add [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_go.md b/docs/git-project-manager_project_go.md similarity index 69% rename from docs/gitlab-project-manager_project_go.md rename to docs/git-project-manager_project_go.md index c0f4b7e..22f81ae 100644 --- a/docs/gitlab-project-manager_project_go.md +++ b/docs/git-project-manager_project_go.md @@ -1,6 +1,6 @@ -## gitlab-project-manager project go +## git-project-manager project go -Go to a GitLab project +Go to a Git project ### Synopsis @@ -11,7 +11,7 @@ will be cloned from source control. If conf.projects.alwaysPull, a git pull will be ran automatically ``` -gitlab-project-manager project go [fuzzy alias search] [flags] +git-project-manager project go [fuzzy alias search] [flags] ``` ### Options @@ -23,7 +23,7 @@ gitlab-project-manager project go [fuzzy alias search] [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -31,6 +31,6 @@ gitlab-project-manager project go [fuzzy alias search] [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_list.md b/docs/git-project-manager_project_list.md similarity index 68% rename from docs/gitlab-project-manager_project_list.md rename to docs/git-project-manager_project_list.md index 42b06ed..609995d 100644 --- a/docs/gitlab-project-manager_project_list.md +++ b/docs/git-project-manager_project_list.md @@ -1,6 +1,6 @@ -## gitlab-project-manager project list +## git-project-manager project list -List GitLab Projects +List Git Projects ### Synopsis @@ -8,7 +8,7 @@ List locally cloned projects. Optionally lists all projects in project cache ``` -gitlab-project-manager project list [flags] +git-project-manager project list [flags] ``` ### Options @@ -21,7 +21,7 @@ gitlab-project-manager project list [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager project list [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_open.md b/docs/git-project-manager_project_open.md similarity index 78% rename from docs/gitlab-project-manager_project_open.md rename to docs/git-project-manager_project_open.md index a1c6b07..0b57b19 100644 --- a/docs/gitlab-project-manager_project_open.md +++ b/docs/git-project-manager_project_open.md @@ -1,4 +1,4 @@ -## gitlab-project-manager project open +## git-project-manager project open Open project in your IDE @@ -11,7 +11,7 @@ If your editor is set in your config file, it will be used, otherwise one will be found in your path from a list of known defaults. ``` -gitlab-project-manager project open [fuzzy alias search] [flags] +git-project-manager project open [fuzzy alias search] [flags] ``` ### Options @@ -26,7 +26,7 @@ gitlab-project-manager project open [fuzzy alias search] [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -34,6 +34,6 @@ gitlab-project-manager project open [fuzzy alias search] [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_run.md b/docs/git-project-manager_project_run.md similarity index 70% rename from docs/gitlab-project-manager_project_run.md rename to docs/git-project-manager_project_run.md index 83d9041..2745841 100644 --- a/docs/gitlab-project-manager_project_run.md +++ b/docs/git-project-manager_project_run.md @@ -1,4 +1,4 @@ -## gitlab-project-manager project run +## git-project-manager project run Run the project (e.g. go run .) @@ -8,7 +8,7 @@ Runs the current project. Tries to detect the language and runs accordingly (e.g. go run .) ``` -gitlab-project-manager project run [flags] +git-project-manager project run [flags] ``` ### Options @@ -20,7 +20,7 @@ gitlab-project-manager project run [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -28,6 +28,6 @@ gitlab-project-manager project run [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager_project_show.md b/docs/git-project-manager_project_show.md similarity index 66% rename from docs/gitlab-project-manager_project_show.md rename to docs/git-project-manager_project_show.md index fa5831e..c976b9c 100644 --- a/docs/gitlab-project-manager_project_show.md +++ b/docs/git-project-manager_project_show.md @@ -1,6 +1,6 @@ -## gitlab-project-manager project show +## git-project-manager project show -Show detail for a GitLab project +Show detail for a Git project ### Synopsis @@ -8,7 +8,7 @@ Shows detail for a particular project Will always fuzzy find ``` -gitlab-project-manager project show [fuzzy alias search] [flags] +git-project-manager project show [fuzzy alias search] [flags] ``` ### Options @@ -21,7 +21,7 @@ gitlab-project-manager project show [fuzzy alias search] [flags] ### Options inherited from parent commands ``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) + --config string config file (default is ~/.config/git-project-manager.yaml) --logLevel string Default log level -- info, warn, error, debug (default "info") --projectPath string Sets a path for local clones of projects --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. @@ -29,6 +29,6 @@ gitlab-project-manager project show [fuzzy alias search] [flags] ### SEE ALSO -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project +* [git-project-manager project](git-project-manager_project.md) - Use a Git project -###### Auto generated by spf13/cobra on 19-Dec-2024 +###### Auto generated by spf13/cobra on 27-Dec-2024 diff --git a/docs/gitlab-project-manager.md b/docs/gitlab-project-manager.md deleted file mode 100644 index 6579b67..0000000 --- a/docs/gitlab-project-manager.md +++ /dev/null @@ -1,30 +0,0 @@ -## gitlab-project-manager - -Find and use GitLab projects locally - -### Synopsis - -Finds GitLab projects using fuzzy-find, remembering -your chosen term for the project as an alias, and offers helpful -shortcuts for moving around in projects and opening your code - -### Options - -``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) - -h, --help help for gitlab-project-manager - --logLevel string Default log level -- info, warn, error, debug (default "info") - --projectPath string Sets a path for local clones of projects - --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. -``` - -### SEE ALSO - -* [gitlab-project-manager alias](gitlab-project-manager_alias.md) - Manage project aliases -* [gitlab-project-manager cache](gitlab-project-manager_cache.md) - Manage GitLab project cache -* [gitlab-project-manager completion](gitlab-project-manager_completion.md) - Generate the autocompletion script for the specified shell -* [gitlab-project-manager config](gitlab-project-manager_config.md) - GitLab Project Manager Configuration -* [gitlab-project-manager docs](gitlab-project-manager_docs.md) - Generate documentation for git-project-manager -* [gitlab-project-manager project](gitlab-project-manager_project.md) - Use a GitLab project - -###### Auto generated by spf13/cobra on 19-Dec-2024 diff --git a/docs/gitlab-project-manager_completion.md b/docs/gitlab-project-manager_completion.md deleted file mode 100644 index 983cd66..0000000 --- a/docs/gitlab-project-manager_completion.md +++ /dev/null @@ -1,34 +0,0 @@ -## gitlab-project-manager completion - -Generate the autocompletion script for the specified shell - -### Synopsis - -Generate the autocompletion script for gitlab-project-manager for the specified shell. -See each sub-command's help for details on how to use the generated script. - - -### Options - -``` - -h, --help help for completion -``` - -### Options inherited from parent commands - -``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) - --logLevel string Default log level -- info, warn, error, debug (default "info") - --projectPath string Sets a path for local clones of projects - --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. -``` - -### SEE ALSO - -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally -* [gitlab-project-manager completion bash](gitlab-project-manager_completion_bash.md) - Generate the autocompletion script for bash -* [gitlab-project-manager completion fish](gitlab-project-manager_completion_fish.md) - Generate the autocompletion script for fish -* [gitlab-project-manager completion powershell](gitlab-project-manager_completion_powershell.md) - Generate the autocompletion script for powershell -* [gitlab-project-manager completion zsh](gitlab-project-manager_completion_zsh.md) - Generate the autocompletion script for zsh - -###### Auto generated by spf13/cobra on 19-Dec-2024 diff --git a/docs/gitlab-project-manager_project.md b/docs/gitlab-project-manager_project.md deleted file mode 100644 index a050fef..0000000 --- a/docs/gitlab-project-manager_project.md +++ /dev/null @@ -1,36 +0,0 @@ -## gitlab-project-manager project - -Use a GitLab project - -### Synopsis - -Switches to a GitLab project by name or alias -If not found, will enter fzf mode. If not cloned, will clone -the project locally. - -### Options - -``` - -h, --help help for project -``` - -### Options inherited from parent commands - -``` - --config string config file (default is ~/.config/gitlab-project-manager.yaml) - --logLevel string Default log level -- info, warn, error, debug (default "info") - --projectPath string Sets a path for local clones of projects - --remote strings Specify remotes by host for any sub-command. Provide multiple times or comma delimited. -``` - -### SEE ALSO - -* [gitlab-project-manager](gitlab-project-manager.md) - Find and use GitLab projects locally -* [gitlab-project-manager project add](gitlab-project-manager_project_add.md) - Add a new GitLab project -* [gitlab-project-manager project go](gitlab-project-manager_project_go.md) - Go to a GitLab project -* [gitlab-project-manager project list](gitlab-project-manager_project_list.md) - List GitLab Projects -* [gitlab-project-manager project open](gitlab-project-manager_project_open.md) - Open project in your IDE -* [gitlab-project-manager project run](gitlab-project-manager_project_run.md) - Run the project (e.g. go run .) -* [gitlab-project-manager project show](gitlab-project-manager_project_show.md) - Show detail for a GitLab project - -###### Auto generated by spf13/cobra on 19-Dec-2024 diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 5254914..ae4920e 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -7,10 +7,11 @@ import ( "time" "github.com/pterm/pterm" + "gopkg.in/yaml.v3" + "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/config" "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes" "gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/projects" - "gopkg.in/yaml.v3" ) type Cache struct { @@ -65,7 +66,7 @@ func (c *Cache) LockCache() { c.log.Info("Attempting to lock cache") c.checkLock() - file, err := os.OpenFile(c.file+".lock", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0640) + file, err := os.OpenFile(c.file+".lock", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640) defer file.Close() if err != nil { @@ -81,7 +82,7 @@ func (c *Cache) checkLock() { // Saves the current state of the cache to disk func (c *Cache) write() { - file, err := os.OpenFile(c.file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0640) + file, err := os.OpenFile(c.file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640) if err != nil { c.log.Error("Failed to write cache to disk", c.log.Args("error", err)) } @@ -92,6 +93,7 @@ func (c *Cache) write() { c.log.Debug("Cache saved to disk") } } + func (c *Cache) Write() { c.lock.Lock() defer c.lock.Unlock() @@ -132,6 +134,7 @@ func (c *Cache) clear(clearAliases bool) { } c.setUpdated() } + func (c *Cache) Clear(clearAliases bool) { c.lock.Lock() defer c.lock.Unlock() @@ -148,7 +151,7 @@ func (c *Cache) refresh(remotes ...string) { c.LoadRemotes(remotes...) } -// Iterates through all GitLab projects the user has access to, updating +// Iterates through all Git projects the user has access to, updating // the project cache where necessary func (c *Cache) Refresh(remotes ...string) { c.lock.Lock() @@ -210,5 +213,5 @@ func NewProjectCache(opts *CacheOpts) (*Cache, error) { } func createProjectCache(path string) error { - return os.WriteFile(path, nil, 0640) + return os.WriteFile(path, nil, 0o640) } diff --git a/internal/remotes/projects/projects_git.go b/internal/remotes/projects/projects_git.go index 611c709..f102a17 100644 --- a/internal/remotes/projects/projects_git.go +++ b/internal/remotes/projects/projects_git.go @@ -23,7 +23,7 @@ func (p *Project) GetGitInfo() string { commit, _ := repo.CommitObject(head.Hash()) str += "\n" + commit.String() - str += pterm.LightMagenta("GitLab: ") + pterm.Bold.Sprint(p.HTTPURLToRepo) + "\n" + str += pterm.LightMagenta("Git: ") + pterm.Bold.Sprint(p.HTTPURLToRepo) + "\n" if remotes, _ := repo.Remotes(); len(remotes) > 0 { str += pterm.LightBlue("Remote: ") + pterm.Bold.Sprint(remotes[0].Config().URLs[0])