Fix bugs, set constants
This commit is contained in:
parent
a54f0629be
commit
03fcbe41ae
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||||
)
|
)
|
||||||
@ -24,7 +25,7 @@ func runAddAliasCmd(cmd *cobra.Command, args []string) {
|
|||||||
var project *projects.Project
|
var project *projects.Project
|
||||||
|
|
||||||
// Check by flag
|
// Check by flag
|
||||||
if projectID := viper.GetInt("alias.add.projectid"); projectID > 0 {
|
if projectID := viper.GetInt(ViperAliasAddPID); projectID > 0 {
|
||||||
plog.Debug(fmt.Sprintf("Adding for inbound project ID %d", projectID))
|
plog.Debug(fmt.Sprintf("Adding for inbound project ID %d", projectID))
|
||||||
project = projectCache.GetProjectByID(projectID)
|
project = projectCache.GetProjectByID(projectID)
|
||||||
}
|
}
|
||||||
@ -97,9 +98,9 @@ func promptAliasesForProject(p *projects.Project) []string {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
aliasCmd.AddCommand(aliasAddCmd)
|
aliasCmd.AddCommand(aliasAddCmd)
|
||||||
aliasAddCmd.PersistentFlags().Int("projectID", 0, "Specify a project by ID")
|
aliasAddCmd.PersistentFlags().Int(FlagProjectID, 0, "Specify a project by ID")
|
||||||
|
|
||||||
aliasAddCmd.RegisterFlagCompletionFunc("projectID", validProjectIdFunc)
|
aliasAddCmd.RegisterFlagCompletionFunc(FlagProjectID, validProjectIdFunc)
|
||||||
|
|
||||||
viper.BindPFlag("alias.add.projectID", aliasAddCmd.Flag("projectID"))
|
viper.BindPFlag(ViperAliasAddPID, aliasAddCmd.Flag(FlagProjectID))
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ var aliasListCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runListAliasCmd(cmd *cobra.Command, args []string) {
|
func runListAliasCmd(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
pterm.DefaultBox.
|
pterm.DefaultBox.
|
||||||
WithLeftPadding(5).WithRightPadding(5).
|
WithLeftPadding(5).WithRightPadding(5).
|
||||||
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
|
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
|
||||||
|
@ -17,7 +17,7 @@ var dumpCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCacheDunpCmd(cmd *cobra.Command, args []string) {
|
func runCacheDunpCmd(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
if conf.Dump.Full {
|
if conf.Dump.Full {
|
||||||
fmt.Println(projectCache.DumpString(true, searchStringFromArgs(args), remotes...))
|
fmt.Println(projectCache.DumpString(true, searchStringFromArgs(args), remotes...))
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,15 +17,15 @@ wants to find a new project.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadCache(cmd *cobra.Command, args []string) {
|
func loadCache(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
projectCache.Refresh(remotes...)
|
projectCache.Refresh(remotes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cacheCmd.AddCommand(loadCmd)
|
cacheCmd.AddCommand(loadCmd)
|
||||||
|
|
||||||
loadCmd.PersistentFlags().Bool("ownerOnly", true,
|
loadCmd.PersistentFlags().Bool(FlagOwnerOnly, true,
|
||||||
"Only load projects that you are owner of")
|
"Only load projects that you are owner of")
|
||||||
|
|
||||||
viper.BindPFlag("cache.load.ownerOnly", loadCmd.Flag("ownerOnly"))
|
viper.BindPFlag(ViperCacheLoadOwnerOnly, loadCmd.Flag(FlagOwnerOnly))
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ var unlockCmd = &cobra.Command{
|
|||||||
Long: `unlocks cache to display`,
|
Long: `unlocks cache to display`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
initProjectCache(cmd, args)
|
initProjectCache(cmd, args)
|
||||||
if viper.GetBool("cache.unlock.force") {
|
if viper.GetBool(ViperCacheUnlockForce) {
|
||||||
projectCache.UnlockCache()
|
projectCache.UnlockCache()
|
||||||
} else if yes, _ := pterm.DefaultInteractiveConfirm.
|
} else if yes, _ := pterm.DefaultInteractiveConfirm.
|
||||||
WithDefaultValue(false).
|
WithDefaultValue(false).
|
||||||
@ -26,6 +26,6 @@ var unlockCmd = &cobra.Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cacheCmd.AddCommand(unlockCmd)
|
cacheCmd.AddCommand(unlockCmd)
|
||||||
unlockCmd.PersistentFlags().BoolP("force", "f", false, "force unlocks cache (don't ask)")
|
unlockCmd.PersistentFlags().BoolP(FlagCacheForce, "f", false, "force unlocks cache (don't ask)")
|
||||||
viper.BindPFlag("cache.unlock.force", unlockCmd.LocalFlags().Lookup("force"))
|
viper.BindPFlag(ViperCacheUnlockForce, unlockCmd.LocalFlags().Lookup(FlagCacheForce))
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,10 @@ import (
|
|||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
|
||||||
"gopkg.in/yaml.v3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var configGenerateCmd = &cobra.Command{
|
var configGenerateCmd = &cobra.Command{
|
||||||
@ -35,7 +36,7 @@ func runConfigGenerateCmd(cmd *cobra.Command, args []string) {
|
|||||||
|
|
||||||
newConf := promptConfigSettings(&conf)
|
newConf := promptConfigSettings(&conf)
|
||||||
|
|
||||||
if write, _ := cmd.Flags().GetBool("write"); write {
|
if write, _ := cmd.Flags().GetBool(FlagWrite); write {
|
||||||
write, _ := pterm.DefaultInteractiveContinue.
|
write, _ := pterm.DefaultInteractiveContinue.
|
||||||
WithDefaultText("Really write config file?").
|
WithDefaultText("Really write config file?").
|
||||||
WithOptions([]string{"yes", "no"}).
|
WithOptions([]string{"yes", "no"}).
|
||||||
@ -59,7 +60,7 @@ func runConfigGenerateCmd(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writeConfigFile(c *config.Config, path string) {
|
func writeConfigFile(c *config.Config, path string) {
|
||||||
file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0640)
|
file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o640)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
plog.Error("Failed to prepare config for writing", plog.Args("error", err))
|
plog.Error("Failed to prepare config for writing", plog.Args("error", err))
|
||||||
}
|
}
|
||||||
@ -149,6 +150,6 @@ func promptConfigSettings(c *config.Config) *config.Config {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
configCmd.AddCommand(configGenerateCmd)
|
configCmd.AddCommand(configGenerateCmd)
|
||||||
configGenerateCmd.PersistentFlags().Bool("prompt", false, "Prompt for settings")
|
configGenerateCmd.PersistentFlags().Bool(FlagPrompt, false, "Prompt for settings")
|
||||||
configGenerateCmd.PersistentFlags().Bool("write", false, "Write config to file")
|
configGenerateCmd.PersistentFlags().Bool(FlagWrite, false, "Write config to file")
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ var configShowCmd = &cobra.Command{
|
|||||||
func runConfigShowCmd(cmd *cobra.Command, args []string) {
|
func runConfigShowCmd(cmd *cobra.Command, args []string) {
|
||||||
c := conf
|
c := conf
|
||||||
|
|
||||||
showSensitive, _ := cmd.Flags().GetBool("sensitive")
|
showSensitive, _ := cmd.Flags().GetBool(FlagSensitive)
|
||||||
if !showSensitive {
|
if !showSensitive {
|
||||||
plog.Info("Sensitive fields hidden, do not use unreviewed as config")
|
plog.Info("Sensitive fields hidden, do not use unreviewed as config")
|
||||||
for _, r := range c.Remotes {
|
for _, r := range c.Remotes {
|
||||||
@ -35,5 +35,5 @@ func runConfigShowCmd(cmd *cobra.Command, args []string) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
configCmd.AddCommand(configShowCmd)
|
configCmd.AddCommand(configShowCmd)
|
||||||
configShowCmd.Flags().BoolP("sensitive", "s", false, "Set to show sensitive fields")
|
configShowCmd.Flags().BoolP(FlagSensitive, "s", false, "Set to show sensitive fields")
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||||
)
|
)
|
||||||
@ -20,7 +21,7 @@ var projectCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getProject(args []string) *projects.Project {
|
func getProject(args []string) *projects.Project {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fzfOpts := &fzfProjectOpts{
|
fzfOpts := &fzfProjectOpts{
|
||||||
Ctx: rootCmd.Context(),
|
Ctx: rootCmd.Context(),
|
||||||
Search: searchStringFromArgs(args),
|
Search: searchStringFromArgs(args),
|
||||||
|
@ -21,7 +21,7 @@ var projectGoCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func projectGoCmdRun(cmd *cobra.Command, args []string) {
|
func projectGoCmdRun(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fzfOpts := &fzfProjectOpts{
|
fzfOpts := &fzfProjectOpts{
|
||||||
Ctx: cmd.Context(),
|
Ctx: cmd.Context(),
|
||||||
Search: searchStringFromArgs(args),
|
Search: searchStringFromArgs(args),
|
||||||
|
@ -16,12 +16,12 @@ var projectListCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func projectListCmdRun(cmd *cobra.Command, args []string) {
|
func projectListCmdRun(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fmt.Println(projectCache.DumpString(viper.GetBool("project.list.all"), searchStringFromArgs(args), remotes...))
|
fmt.Println(projectCache.DumpString(viper.GetBool(ViperProjectListAll), searchStringFromArgs(args), remotes...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
projectCmd.AddCommand(projectListCmd)
|
projectCmd.AddCommand(projectListCmd)
|
||||||
projectListCmd.PersistentFlags().Bool("all", false, "List all, not just cloned locally")
|
projectListCmd.PersistentFlags().Bool(FlagAll, false, "List all, not just cloned locally")
|
||||||
viper.BindPFlag("project.list.all", projectListCmd.Flag("all"))
|
viper.BindPFlag(ViperProjectListAll, projectListCmd.Flag(FlagAll))
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func projectOpenCmdRun(cmd *cobra.Command, args []string) {
|
|||||||
plog.Fatal("No usable editor found")
|
plog.Fatal("No usable editor found")
|
||||||
}
|
}
|
||||||
|
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fzfOpts := &fzfProjectOpts{
|
fzfOpts := &fzfProjectOpts{
|
||||||
Ctx: cmd.Context(),
|
Ctx: cmd.Context(),
|
||||||
Search: searchStringFromArgs(args),
|
Search: searchStringFromArgs(args),
|
||||||
@ -172,7 +172,7 @@ func isEditorExecutable(editor string) bool {
|
|||||||
|
|
||||||
stat, err := os.Stat(editor)
|
stat, err := os.Stat(editor)
|
||||||
|
|
||||||
if err == nil && (stat.Mode()&0444 != 0 && stat.Mode()&0111 != 0) {
|
if err == nil && (stat.Mode()&0o444 != 0 && stat.Mode()&0o111 != 0) {
|
||||||
canExec = true
|
canExec = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ var projectRunCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func projectRunCmdRun(cmd *cobra.Command, args []string) {
|
func projectRunCmdRun(cmd *cobra.Command, args []string) {
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fzfOpts := &fzfProjectOpts{
|
fzfOpts := &fzfProjectOpts{
|
||||||
Ctx: cmd.Context(),
|
Ctx: cmd.Context(),
|
||||||
Search: searchStringFromArgs(args),
|
Search: searchStringFromArgs(args),
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ func projectShowCmdRun(cmd *cobra.Command, args []string) {
|
|||||||
var project *projects.Project
|
var project *projects.Project
|
||||||
var inCwd bool
|
var inCwd bool
|
||||||
|
|
||||||
remotes := viper.GetStringSlice("remote")
|
remotes := viper.GetStringSlice(FlagRemote)
|
||||||
fzfOpts := &fzfProjectOpts{
|
fzfOpts := &fzfProjectOpts{
|
||||||
Ctx: cmd.Context(),
|
Ctx: cmd.Context(),
|
||||||
Search: searchStringFromArgs(args),
|
Search: searchStringFromArgs(args),
|
||||||
@ -31,7 +32,7 @@ func projectShowCmdRun(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find project from current directory
|
// Try to find project from current directory
|
||||||
if viper.GetBool("project.show.current") {
|
if viper.GetBool(ViperProjectShowCurrent) {
|
||||||
var err error
|
var err error
|
||||||
project, err = projectCache.GetProjectFromCwd()
|
project, err = projectCache.GetProjectFromCwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -78,6 +79,6 @@ func projectShowCmdRun(cmd *cobra.Command, args []string) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
projectCmd.AddCommand(projectShowCmd)
|
projectCmd.AddCommand(projectShowCmd)
|
||||||
projectShowCmd.PersistentFlags().Bool("current", false, "Use project in CWD rather than fuzzy find")
|
projectShowCmd.PersistentFlags().Bool(FlagCurrent, false, "Use project in CWD rather than fuzzy find")
|
||||||
viper.BindPFlag("project.show.current", projectShowCmd.Flag("current"))
|
viper.BindPFlag(ViperProjectShowCurrent, projectShowCmd.Flag(FlagCurrent))
|
||||||
}
|
}
|
||||||
|
26
cmd/root.go
26
cmd/root.go
@ -9,11 +9,14 @@ import (
|
|||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var conf config.Config
|
var (
|
||||||
var plog *pterm.Logger
|
conf config.Config
|
||||||
|
plog *pterm.Logger
|
||||||
|
)
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "gitlab-project-manager",
|
Use: "gitlab-project-manager",
|
||||||
@ -36,7 +39,6 @@ func Execute() {
|
|||||||
defer cncl()
|
defer cncl()
|
||||||
|
|
||||||
err := rootCmd.ExecuteContext(ctx)
|
err := rootCmd.ExecuteContext(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pterm.Error.Printfln(pterm.LightYellow("Command failed, " + err.Error()))
|
pterm.Error.Printfln(pterm.LightYellow("Command failed, " + err.Error()))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -48,25 +50,25 @@ func init() {
|
|||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
|
|
||||||
// Global flags
|
// Global flags
|
||||||
rootCmd.PersistentFlags().String("config", "",
|
rootCmd.PersistentFlags().String(FlagConfig, "",
|
||||||
"config file (default is "+defConfigPath+")")
|
"config file (default is "+defConfigPath+")")
|
||||||
rootCmd.PersistentFlags().String("projectPath", "",
|
rootCmd.PersistentFlags().String(FlagPath, "",
|
||||||
"Sets a path for local clones of projects")
|
"Sets a path for local clones of projects")
|
||||||
rootCmd.PersistentFlags().String("logLevel", defLogLevel,
|
rootCmd.PersistentFlags().String(FlagLogLevel, defLogLevel,
|
||||||
"Default log level -- info, warn, error, debug")
|
"Default log level -- info, warn, error, debug")
|
||||||
rootCmd.PersistentFlags().StringSlice("remote", []string{},
|
rootCmd.PersistentFlags().StringSlice(FlagRemote, []string{},
|
||||||
"Specify remotes by host for any sub-command. Provide multiple times or comma delimited.")
|
"Specify remotes by host for any sub-command. Provide multiple times or comma delimited.")
|
||||||
|
|
||||||
// Flag autocompletion
|
// Flag autocompletion
|
||||||
rootCmd.RegisterFlagCompletionFunc("logLevel", validLogLevelsFunc)
|
rootCmd.RegisterFlagCompletionFunc(FlagLogLevel, validLogLevelsFunc)
|
||||||
rootCmd.RegisterFlagCompletionFunc("remote", validRemotesFunc)
|
rootCmd.RegisterFlagCompletionFunc(FlagRemote, validRemotesFunc)
|
||||||
|
|
||||||
viper.BindPFlags(rootCmd.PersistentFlags())
|
viper.BindPFlags(rootCmd.PersistentFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
// initConfig reads in config file and ENV variables if set.
|
// initConfig reads in config file and ENV variables if set.
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
cfgFile := viper.GetString("config")
|
cfgFile := viper.GetString(FlagConfig)
|
||||||
if cfgFile != "" {
|
if cfgFile != "" {
|
||||||
// Use config file from the flag.
|
// Use config file from the flag.
|
||||||
viper.SetConfigFile(cfgFile)
|
viper.SetConfigFile(cfgFile)
|
||||||
@ -86,7 +88,7 @@ func initConfig() {
|
|||||||
|
|
||||||
// Configure pretty logger
|
// Configure pretty logger
|
||||||
plog = pterm.DefaultLogger.
|
plog = pterm.DefaultLogger.
|
||||||
WithLevel(getPtermLogLevel(viper.GetString("logLevel"))).
|
WithLevel(getPtermLogLevel(viper.GetString(FlagLogLevel))).
|
||||||
WithWriter(os.Stderr)
|
WithWriter(os.Stderr)
|
||||||
if plog.Level == pterm.LogLevelDebug {
|
if plog.Level == pterm.LogLevelDebug {
|
||||||
pterm.EnableDebugMessages()
|
pterm.EnableDebugMessages()
|
||||||
@ -137,7 +139,7 @@ func checkConfigPerms(file string) {
|
|||||||
plog.Error("Failure reading configuration", plog.Args("err", err))
|
plog.Error("Failure reading configuration", plog.Args("err", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if stat.Mode().Perm()&0004 == 0004 {
|
if stat.Mode().Perm()&0o004 == 0o004 {
|
||||||
plog.Error("Configuration is world-readable. Recomment 0400.",
|
plog.Error("Configuration is world-readable. Recomment 0400.",
|
||||||
plog.Args("mode", stat.Mode().String()))
|
plog.Args("mode", stat.Mode().String()))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -1,5 +1,28 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Cobra Flags
|
||||||
|
FlagRemote = "remote"
|
||||||
|
FlagConfig = "config"
|
||||||
|
FlagPath = "projectPath"
|
||||||
|
FlagLogLevel = "logLevel"
|
||||||
|
FlagProjectID = "projectID"
|
||||||
|
FlagCacheForce = "force"
|
||||||
|
FlagOwnerOnly = "ownerOnly"
|
||||||
|
FlagAll = "all"
|
||||||
|
FlagCurrent = "current"
|
||||||
|
FlagPrompt = "prompt"
|
||||||
|
FlagWrite = "write"
|
||||||
|
FlagSensitive = "sensitive"
|
||||||
|
|
||||||
|
// Viper config bindings
|
||||||
|
ViperAliasAddPID = "alias.add.projectID"
|
||||||
|
ViperCacheUnlockForce = "cache.unlock.force"
|
||||||
|
ViperCacheLoadOwnerOnly = "cache.load.ownerOnly"
|
||||||
|
ViperProjectListAll = "project.list.all"
|
||||||
|
ViperProjectShowCurrent = "project.show.current"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defGitlabHost = "https://gitlab.com"
|
defGitlabHost = "https://gitlab.com"
|
||||||
defLogLevel = "info"
|
defLogLevel = "info"
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
fzf "github.com/ktr0731/go-fuzzyfinder"
|
fzf "github.com/ktr0731/go-fuzzyfinder"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/cache"
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||||
"golang.org/x/exp/slices"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type fzfProjectOpts struct {
|
type fzfProjectOpts struct {
|
||||||
@ -96,7 +97,8 @@ func fzfAliasFromAliases(opts *fzfProjectOpts, aliases []*cache.ProjectAlias) *c
|
|||||||
// Given a list of aliases, merge them together and use the resulting
|
// Given a list of aliases, merge them together and use the resulting
|
||||||
// list of projects to return a project
|
// list of projects to return a project
|
||||||
func fzfProjectFromAliases(opts *fzfProjectOpts, aliases []*cache.ProjectAlias) (
|
func fzfProjectFromAliases(opts *fzfProjectOpts, aliases []*cache.ProjectAlias) (
|
||||||
*projects.Project, error) {
|
*projects.Project, error,
|
||||||
|
) {
|
||||||
mergedProjects := projectsFromAliases(aliases)
|
mergedProjects := projectsFromAliases(aliases)
|
||||||
if len(mergedProjects) == 1 {
|
if len(mergedProjects) == 1 {
|
||||||
return mergedProjects[0], nil
|
return mergedProjects[0], nil
|
||||||
@ -105,20 +107,16 @@ func fzfProjectFromAliases(opts *fzfProjectOpts, aliases []*cache.ProjectAlias)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func projectsFromAliases(aliases []*cache.ProjectAlias) []*projects.Project {
|
func projectsFromAliases(aliases []*cache.ProjectAlias) []*projects.Project {
|
||||||
projects := make([]*projects.Project, 0)
|
projects := make([]*projects.Project, 0, len(aliases))
|
||||||
|
|
||||||
ALIASES:
|
|
||||||
for _, a := range aliases {
|
for _, a := range aliases {
|
||||||
for _, p := range projects {
|
project := projectCache.GetProjectByAlias(a)
|
||||||
// Already have it
|
if project != nil && !slices.Contains(projects, project) {
|
||||||
if p == nil || (a.ProjectID == p.ID && a.Remote == p.Remote) {
|
projects = append(projects, project)
|
||||||
continue ALIASES
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
projects = append(projects, projectCache.GetProjectByAlias(a))
|
|
||||||
}
|
|
||||||
|
|
||||||
return projects
|
return slices.Clip(projects)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If opts.MustHaveAlias, will only allow selection of projects
|
// If opts.MustHaveAlias, will only allow selection of projects
|
||||||
@ -137,7 +135,8 @@ func fzfProject(opts *fzfProjectOpts) (*projects.Project, error) {
|
|||||||
|
|
||||||
// Takes a list of projects and performs a fuzzyfind
|
// Takes a list of projects and performs a fuzzyfind
|
||||||
func fzfProjectFromProjects(opts *fzfProjectOpts, projects []*projects.Project) (
|
func fzfProjectFromProjects(opts *fzfProjectOpts, projects []*projects.Project) (
|
||||||
*projects.Project, error) {
|
*projects.Project, error,
|
||||||
|
) {
|
||||||
i, err := fzf.Find(projects,
|
i, err := fzf.Find(projects,
|
||||||
func(i int) string {
|
func(i int) string {
|
||||||
// Display the project along with its aliases
|
// Display the project along with its aliases
|
||||||
|
46
go.mod
46
go.mod
@ -1,18 +1,18 @@
|
|||||||
module gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager
|
module gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager
|
||||||
|
|
||||||
go 1.22.1
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-git/go-git/v5 v5.12.0
|
github.com/go-git/go-git/v5 v5.12.0
|
||||||
github.com/ktr0731/go-fuzzyfinder v0.8.0
|
github.com/ktr0731/go-fuzzyfinder v0.8.0
|
||||||
github.com/lithammer/fuzzysearch v1.1.8
|
github.com/lithammer/fuzzysearch v1.1.8
|
||||||
github.com/pterm/pterm v0.12.79
|
github.com/pterm/pterm v0.12.79
|
||||||
github.com/spf13/cobra v1.8.0
|
github.com/spf13/cobra v1.8.1
|
||||||
github.com/spf13/viper v1.18.2
|
github.com/spf13/viper v1.19.0
|
||||||
github.com/whilp/git-urls v1.0.0
|
github.com/whilp/git-urls v1.0.0
|
||||||
github.com/xanzy/go-gitlab v0.104.1
|
github.com/xanzy/go-gitlab v0.109.0
|
||||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
|
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
|
||||||
golang.org/x/sys v0.20.0
|
golang.org/x/sys v0.25.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,13 +20,13 @@ require (
|
|||||||
atomicgo.dev/cursor v0.2.0 // indirect
|
atomicgo.dev/cursor v0.2.0 // indirect
|
||||||
atomicgo.dev/keyboard v0.2.9 // indirect
|
atomicgo.dev/keyboard v0.2.9 // indirect
|
||||||
atomicgo.dev/schedule v0.1.0 // indirect
|
atomicgo.dev/schedule v0.1.0 // indirect
|
||||||
code.gitea.io/sdk/gitea v0.18.0 // direct
|
code.gitea.io/sdk/gitea v0.19.0 // direct
|
||||||
dario.cat/mergo v1.0.0 // indirect
|
dario.cat/mergo v1.0.1 // indirect
|
||||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||||
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
||||||
github.com/cloudflare/circl v1.3.8 // indirect
|
github.com/cloudflare/circl v1.4.0 // indirect
|
||||||
github.com/containerd/console v1.0.4 // indirect
|
github.com/containerd/console v1.0.4 // indirect
|
||||||
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
|
github.com/cyphar/filepath-securejoin v0.3.3 // indirect
|
||||||
github.com/davidmz/go-pageant v1.0.2 // indirect
|
github.com/davidmz/go-pageant v1.0.2 // indirect
|
||||||
github.com/emirpasic/gods v1.18.1 // indirect
|
github.com/emirpasic/gods v1.18.1 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||||
@ -40,8 +40,8 @@ require (
|
|||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/gookit/color v1.5.4 // indirect
|
github.com/gookit/color v1.5.4 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
|
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
||||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
@ -49,31 +49,31 @@ require (
|
|||||||
github.com/ktr0731/go-ansisgr v0.1.0 // indirect
|
github.com/ktr0731/go-ansisgr v0.1.0 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/nsf/termbox-go v1.1.1 // indirect
|
github.com/nsf/termbox-go v1.1.1 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
|
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
|
||||||
github.com/skeema/knownhosts v1.2.2 // indirect
|
github.com/skeema/knownhosts v1.3.0 // indirect
|
||||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spf13/afero v1.11.0 // indirect
|
github.com/spf13/afero v1.11.0 // indirect
|
||||||
github.com/spf13/cast v1.6.0 // indirect
|
github.com/spf13/cast v1.7.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/subosito/gotenv v1.6.0 // indirect
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/crypto v0.23.0 // indirect
|
golang.org/x/crypto v0.27.0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/net v0.29.0 // indirect
|
||||||
golang.org/x/oauth2 v0.20.0 // indirect
|
golang.org/x/oauth2 v0.23.0 // indirect
|
||||||
golang.org/x/term v0.20.0 // indirect
|
golang.org/x/term v0.24.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/text v0.18.0 // indirect
|
||||||
golang.org/x/time v0.5.0 // indirect
|
golang.org/x/time v0.6.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
)
|
)
|
||||||
|
47
go.sum
47
go.sum
@ -8,8 +8,12 @@ atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs=
|
|||||||
atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU=
|
atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU=
|
||||||
code.gitea.io/sdk/gitea v0.18.0 h1:+zZrwVmujIrgobt6wVBWCqITz6bn1aBjnCUHmpZrerI=
|
code.gitea.io/sdk/gitea v0.18.0 h1:+zZrwVmujIrgobt6wVBWCqITz6bn1aBjnCUHmpZrerI=
|
||||||
code.gitea.io/sdk/gitea v0.18.0/go.mod h1:IG9xZJoltDNeDSW0qiF2Vqx5orMWa7OhVWrjvrd5NpI=
|
code.gitea.io/sdk/gitea v0.18.0/go.mod h1:IG9xZJoltDNeDSW0qiF2Vqx5orMWa7OhVWrjvrd5NpI=
|
||||||
|
code.gitea.io/sdk/gitea v0.19.0 h1:8I6s1s4RHgzxiPHhOQdgim1RWIRcr0LVMbHBjBFXq4Y=
|
||||||
|
code.gitea.io/sdk/gitea v0.19.0/go.mod h1:IG9xZJoltDNeDSW0qiF2Vqx5orMWa7OhVWrjvrd5NpI=
|
||||||
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||||
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
|
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
|
||||||
|
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs=
|
github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs=
|
||||||
github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8=
|
github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8=
|
||||||
github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII=
|
github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII=
|
||||||
@ -33,12 +37,19 @@ github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7N
|
|||||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||||
github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
|
github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
|
||||||
github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
|
github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
|
||||||
|
github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY=
|
||||||
|
github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
|
||||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
||||||
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
|
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
|
||||||
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
|
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo=
|
github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.3.2 h1:QhZu5AxQ+o1XZH0Ye05YzvJ0kAdK6VQc0z9NNMek7gc=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.3.2/go.mod h1:F7i41x/9cBF7lzCrVsYs9fuzwRZm4NQsGTBdpp6mETc=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.3.3 h1:lofZkCEVFIBe0KcdQOzFs8Soy9oaHOWl4gGtPI+gCFc=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.3.3/go.mod h1:8s/MCNJREmFK0H02MF6Ihv1nakJe4L/w3WZLHNkvlYM=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||||
@ -95,8 +106,12 @@ github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+
|
|||||||
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
|
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
|
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
|
||||||
|
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
|
||||||
|
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
|
||||||
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
||||||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
|
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
|
||||||
|
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
@ -136,6 +151,8 @@ github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh
|
|||||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY=
|
github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY=
|
||||||
@ -144,6 +161,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
|
|||||||
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
|
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||||
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
||||||
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
@ -169,6 +188,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
|
|||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||||
|
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
|
||||||
|
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
|
||||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
@ -177,18 +198,26 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG
|
|||||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A=
|
github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A=
|
||||||
github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||||
|
github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY=
|
||||||
|
github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M=
|
||||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||||
|
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
|
||||||
|
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||||
|
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||||
|
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
|
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
|
||||||
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
|
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
|
||||||
|
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||||
|
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
@ -208,6 +237,8 @@ github.com/whilp/git-urls v1.0.0 h1:95f6UMWN5FKW71ECsXRUd3FVYiXdrE7aX4NZKcPmIjU=
|
|||||||
github.com/whilp/git-urls v1.0.0/go.mod h1:J16SAmobsqc3Qcy98brfl5f5+e0clUvg1krgwk/qCfE=
|
github.com/whilp/git-urls v1.0.0/go.mod h1:J16SAmobsqc3Qcy98brfl5f5+e0clUvg1krgwk/qCfE=
|
||||||
github.com/xanzy/go-gitlab v0.104.1 h1:g/liXIPJH0jsTwVuzTAUMiKdTf6Qup3u2XZq5Rp90Wc=
|
github.com/xanzy/go-gitlab v0.104.1 h1:g/liXIPJH0jsTwVuzTAUMiKdTf6Qup3u2XZq5Rp90Wc=
|
||||||
github.com/xanzy/go-gitlab v0.104.1/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
|
github.com/xanzy/go-gitlab v0.104.1/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
|
||||||
|
github.com/xanzy/go-gitlab v0.109.0 h1:RcRme5w8VpLXTSTTMZdVoQWY37qTJWg+gwdQl4aAttE=
|
||||||
|
github.com/xanzy/go-gitlab v0.109.0/go.mod h1:wKNKh3GkYDMOsGmnfuX+ITCmDuSDWFO0G+C4AygL9RY=
|
||||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
||||||
@ -225,8 +256,12 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
|
|||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
|
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
|
||||||
|
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
|
||||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
|
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
|
||||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
||||||
|
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
|
||||||
|
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
@ -239,8 +274,12 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
|||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
|
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
|
||||||
|
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
|
||||||
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
|
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
|
||||||
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
|
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
||||||
|
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -265,6 +304,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||||
|
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
@ -275,6 +316,8 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
|||||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
|
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
|
||||||
|
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
@ -286,8 +329,12 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
|||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
|
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
|
||||||
|
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
|
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
||||||
|
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
14
internal/cache/fuzz.go
vendored
14
internal/cache/fuzz.go
vendored
@ -4,6 +4,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/lithammer/fuzzysearch/fuzzy"
|
"github.com/lithammer/fuzzysearch/fuzzy"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,14 +29,16 @@ func (c *Cache) FuzzyFindAlias(name string) []*ProjectAlias {
|
|||||||
c.log.Debug("Fuzzy found multiple aliases, try being more specific",
|
c.log.Debug("Fuzzy found multiple aliases, try being more specific",
|
||||||
c.log.Args("foundAliases", strings.Join(found, ", ")))
|
c.log.Args("foundAliases", strings.Join(found, ", ")))
|
||||||
}
|
}
|
||||||
var aliases []*ProjectAlias
|
aliases := make([]*ProjectAlias, 0, ranks.Len())
|
||||||
if ranks.Len() > 0 {
|
if ranks.Len() > 0 {
|
||||||
aliases = make([]*ProjectAlias, ranks.Len())
|
for _, r := range ranks {
|
||||||
for i, r := range ranks {
|
alias := c.GetAliasByName(r.Target)
|
||||||
aliases[i] = c.GetAliasByName(r.Target)
|
if alias != nil {
|
||||||
|
aliases = append(aliases, alias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aliases
|
}
|
||||||
|
return slices.Clip(aliases)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns all matching projects by fuzzy find term
|
// Returns all matching projects by fuzzy find term
|
||||||
|
7
internal/cache/projects_fs.go
vendored
7
internal/cache/projects_fs.go
vendored
@ -48,14 +48,11 @@ func (c *Cache) GetProjectFromCwd() (*projects.Project, error) {
|
|||||||
|
|
||||||
func (c *Cache) IsProjectCloned(p *projects.Project) bool {
|
func (c *Cache) IsProjectCloned(p *projects.Project) bool {
|
||||||
_, err := os.Stat(c.GetProjectPath(p) + "/.git")
|
_, err := os.Stat(c.GetProjectPath(p) + "/.git")
|
||||||
if err == nil {
|
return err == nil
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) PrepProjectPath(path string) {
|
func (c *Cache) PrepProjectPath(path string) {
|
||||||
if err := os.MkdirAll(path, 0750); err != nil {
|
if err := os.MkdirAll(path, 0o750); err != nil {
|
||||||
c.log.Fatal("Failed to prepare project path", c.log.Args(
|
c.log.Fatal("Failed to prepare project path", c.log.Args(
|
||||||
"path", path,
|
"path", path,
|
||||||
"error", err,
|
"error", err,
|
||||||
|
Loading…
Reference in New Issue
Block a user