Move from --gitlab flags to global --remote flags
This commit is contained in:
parent
702f599f5f
commit
c36607c62d
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/pterm/pterm"
|
"github.com/pterm/pterm"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// listCmd represents the list command
|
// listCmd represents the list command
|
||||||
@ -18,12 +19,13 @@ var aliasListCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runListAliasCmd(cmd *cobra.Command, args []string) {
|
func runListAliasCmd(cmd *cobra.Command, args []string) {
|
||||||
|
remotes := viper.GetStringSlice("remote")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
pterm.DefaultBox.
|
pterm.DefaultBox.
|
||||||
WithLeftPadding(5).WithRightPadding(5).
|
WithLeftPadding(5).WithRightPadding(5).
|
||||||
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
|
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
|
||||||
WithTitle(pterm.Bold.Sprint(pterm.LightGreen("Aliases by Project"))).
|
WithTitle(pterm.Bold.Sprint(pterm.LightGreen("Aliases by Project"))).
|
||||||
Print("\n" + projectCache.AliasesByProjectString())
|
Print("\n" + projectCache.AliasesByProjectString(remotes...))
|
||||||
fmt.Print("\n\n")
|
fmt.Print("\n\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
internal/cache/projects_alias.go
vendored
5
internal/cache/projects_alias.go
vendored
@ -43,13 +43,16 @@ func ProjectAliasesString(aliases []*ProjectAlias) string {
|
|||||||
return strings.Trim(str, " ")
|
return strings.Trim(str, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) AliasesByProjectString() string {
|
func (c *Cache) AliasesByProjectString(remotes ...string) string {
|
||||||
var str bytes.Buffer
|
var str bytes.Buffer
|
||||||
|
|
||||||
w := new(tabwriter.Writer)
|
w := new(tabwriter.Writer)
|
||||||
w.Init(&str, 10, 0, 0, ' ', tabwriter.AlignRight)
|
w.Init(&str, 10, 0, 0, ' ', tabwriter.AlignRight)
|
||||||
|
|
||||||
for _, p := range c.GetProjectsWithAliases() {
|
for _, p := range c.GetProjectsWithAliases() {
|
||||||
|
if !slices.Contains(remotes, p.Remote) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
var pa string
|
var pa string
|
||||||
pa += pterm.LightBlue("- ")
|
pa += pterm.LightBlue("- ")
|
||||||
pa += fmt.Sprint(pterm.Bold.Sprint(p.String()) + " \t ")
|
pa += fmt.Sprint(pterm.Bold.Sprint(p.String()) + " \t ")
|
||||||
|
Loading…
Reference in New Issue
Block a user