git-project-manager/cmd/alias_list.go

33 lines
749 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",
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())
fmt.Println("\n")
// fmt.Print("\n" + cache.AliasesByProjectString() + "\n")
2023-12-09 04:13:17 +00:00
}
func init() {
aliasCmd.AddCommand(aliasListCmd)
}