blob: d4788451548ae972a409a3f489dfd4cd6a44f5fd [file] [log] [blame] [edit]
package cmd
import (
"fmt"
"os"
"github.com/Masterminds/cookoo"
)
// Mkdir creates the src directory within the GOPATH.
func Mkdir(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {
target := p.Get("dir", "").(string)
if len(target) == 0 {
return nil, fmt.Errorf("Vendor path appears to be unset")
}
if err := os.MkdirAll(target, os.ModeDir|0755); err != nil {
return false, fmt.Errorf("Failed to make directory %s: %s", target, err)
}
return true, nil
}