git-project-manager/cmd/alias.go

26 lines
507 B
Go

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