Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Grifts generator #477

Closed
paganotoni opened this issue Jun 21, 2017 · 5 comments
Closed

Grifts generator #477

paganotoni opened this issue Jun 21, 2017 · 5 comments
Assignees
Milestone

Comments

@paganotoni
Copy link
Member

paganotoni commented Jun 21, 2017

It would be good to have a generator for grift tasks.

CLI:

$ buffalo g grift taskName

Would generate:

grifts/task_name.go

And contents of the grift task would be something like:

package grifts

import (
	. "github.com/markbates/grift/grift"
)

var _ = Desc("task_name", "TODO")
var _ = Add("task_name", func(c *Context) error {
	return nil
})

cc @markbates

@paganotoni paganotoni added this to the 0.9.1 milestone Jun 21, 2017
@paganotoni paganotoni self-assigned this Jun 21, 2017
@markbates
Copy link
Member

I would also generate a Desc function as well.

package grifts

import (
	. "github.com/markbates/grift/grift"
)

var _ = Desc("task_name", "TODO")
var _ = Add("task_name", func(c *Context) error {
	return nil
})

@markbates
Copy link
Member

Also, if the task name contains : we should use Namespace:

$ buffalo g grift a:b:c
package grifts

import (
	. "github.com/markbates/grift/grift"
)

var _ = Namespace("a", func() {
  Namespace("b", func() {
    Desc("c", "TODO")
    Add("c", func(c *Context) error {
	return nil
    })
  })
})

@paganotoni
Copy link
Member Author

Nice!! i didn't know about namespaces in grift! thanks @markbates

@markbates
Copy link
Member

@apaganobeleno that's because it only got merged in today! :) markbates/grift#10

@paganotoni
Copy link
Member Author

covered in #479

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants