Skip to content

Commit

Permalink
Allow additional arguments to be provided to dep
Browse files Browse the repository at this point in the history
Fixes #384
  • Loading branch information
fraenkel committed Oct 14, 2018
1 parent d1fc6f7 commit 4adca08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/init_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ kubebuilder init --domain example.org --license apache2 --owner "The Kubernetes
initCmd.Flags().BoolVar(
&o.dep, "dep", true, "if specified, determines whether dep will be used.")
o.depFlag = initCmd.Flag("dep")
initCmd.Flags().StringArrayVar(&o.depArgs, "depArgs", nil, "Additional arguments for dep")

o.prj = projectForFlags(initCmd.Flags())
o.bp = boilerplateForFlags(initCmd.Flags())
Expand All @@ -84,6 +85,7 @@ type projectOptions struct {
dkr *manager.Dockerfile
dep bool
depFlag *flag.Flag
depArgs []string
}

func (o *projectOptions) runInit() {
Expand Down Expand Up @@ -145,6 +147,9 @@ func (o *projectOptions) runInit() {
}
if o.dep {
c := exec.Command("dep", "ensure") // #nosec
if len(o.depArgs) > 0 {
c.Args = append(c.Args, o.depArgs...)
}
c.Stderr = os.Stderr
c.Stdout = os.Stdout
fmt.Println(strings.Join(c.Args, " "))
Expand Down

0 comments on commit 4adca08

Please sign in to comment.