package alias import ( "fmt" "github.com/pterm/pterm" "github.com/spf13/cobra" "github.com/spf13/viper" "gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd/util" ) // listCmd represents the list command var aliasListCmd = &cobra.Command{ Use: "list", Aliases: []string{"dump", "show", "ls", "ll", "l"}, Short: "List Aliases", PreRun: mustHaveAliases, Long: util.AliasListCmdLong, Run: runListAliasCmd, } func runListAliasCmd(cmd *cobra.Command, args []string) { remotes := viper.GetStringSlice(util.FlagRemote) aliases := utils.Cache().AliasesByProjectString(remotes...) printer := pterm.DefaultBox. WithLeftPadding(5).WithRightPadding(5). WithBoxStyle(&pterm.Style{pterm.FgLightBlue}). WithTitle(pterm.Bold.Sprint(pterm.LightGreen("Aliases by Project"))) if len(aliases) < 1 { printer.Print("\n" + "No Aliases Found") } else { printer.Print("\n" + aliases) } fmt.Print("\n\n") }