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(projectCache.Aliases) == 0 { plog.Fatal("No aliases set, nothing to " + cmd.Name()) } }