git-project-manager/cmd/alias.go

26 lines
507 B
Go
Raw Normal View History

2023-12-04 21:53:01 +00:00
package cmd
import (
"github.com/spf13/cobra"
)
var aliasCmd = &cobra.Command{
2023-12-09 04:13:17 +00:00
Use: "alias",
Aliases: []string{"aliases", "a"},
Short: "Manage project aliases",
Long: aliasCmdLong,
2023-12-08 21:52:26 +00:00
// Just re-use the hooks for project
PersistentPreRun: initProjectCmd,
PersistentPostRun: postProjectCmd,
2023-12-04 21:53:01 +00:00
}
func init() {
rootCmd.AddCommand(aliasCmd)
}
2023-12-10 15:10:46 +00:00
func mustHaveAliases(cmd *cobra.Command, args []string) {
if len(cache.Aliases) == 0 {
plog.Fatal("No aliases set, nothing to " + cmd.Name())
}
}