buffalo: github.com/gobuffalo/buffalo/buffalo/cmd/destroy Index | Files

package destroy

import "github.com/gobuffalo/buffalo/buffalo/cmd/destroy"

Index

Package Files

action.go mailer.go resource.go

Variables

var ActionCmd = &cobra.Command{
    Use: "action [name]",

    Aliases: []string{"a"},
    Short:   "Destroy action files",
    RunE: func(cmd *cobra.Command, args []string) error {
        if len(args) == 0 {
            return fmt.Errorf("you need to provide a valid action file name in order to destroy it")
        }

        name := args[0]

        fileName := flect.Underscore(name)

        removeActions(fileName)
        return nil
    },
}

ActionCmd destroys passed action file

var MailerCmd = &cobra.Command{
    Use: "mailer [name]",

    Aliases: []string{"l"},
    Short:   "Destroy mailer files",
    RunE: func(cmd *cobra.Command, args []string) error {
        if len(args) == 0 {
            return fmt.Errorf("you need to provide a valid mailer name in order to destroy it")
        }

        name := args[0]

        removeMailer(name)

        return nil
    },
}

MailerCmd destroys a passed mailer

var ResourceCmd = &cobra.Command{
    Use: "resource [name]",

    Aliases: []string{"r"},
    Short:   "Destroy resource files",
    RunE: func(cmd *cobra.Command, args []string) error {
        if len(args) == 0 {
            return fmt.Errorf("you need to provide a valid resource name in order to destroy it")
        }

        name := args[0]
        fileName := flect.Pluralize(flect.Underscore(name))

        removeTemplates(fileName)
        if err := removeActions(fileName); err != nil {
            return err
        }

        removeLocales(fileName)
        removeModel(name)
        removeMigrations(fileName)

        return nil
    },
}

ResourceCmd destroys a passed resource

var YesToAll = false

YesToAll means not to ask when destroying but simply confirm all beforehand.

Package destroy imports 9 packages (graph) and is imported by 13 packages. Updated 2019-07-29. Refresh now. Tools for package owners.