git-project-manager/cmd/alias_list.go

33 lines
716 B
Go
Raw Normal View History

2023-12-09 04:13:17 +00:00
package cmd
import (
"fmt"
2023-12-10 04:45:30 +00:00
"github.com/pterm/pterm"
2023-12-09 04:13:17 +00:00
"github.com/spf13/cobra"
)
// listCmd represents the list command
var aliasListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"dump", "show", "ls", "ll", "l"},
Short: "List Aliases",
2023-12-10 15:10:46 +00:00
PreRun: mustHaveAliases,
2023-12-09 04:13:17 +00:00
Long: aliasListCmdLong,
Run: runListAliasCmd,
}
func runListAliasCmd(cmd *cobra.Command, args []string) {
2023-12-10 04:45:30 +00:00
fmt.Println()
pterm.DefaultBox.
WithLeftPadding(5).WithRightPadding(5).
WithBoxStyle(&pterm.Style{pterm.FgLightBlue}).
WithTitle(pterm.Bold.Sprint(pterm.LightGreen("Aliases by Project"))).
Print("\n" + cache.AliasesByProjectString())
2023-12-10 05:05:39 +00:00
fmt.Print("\n\n")
2023-12-09 04:13:17 +00:00
}
func init() {
aliasCmd.AddCommand(aliasListCmd)
}