(c *cobra.Command, args []string)
| 109 | } |
| 110 | |
| 111 | func (cmd *buildCommand) ValidateArgs(c *cobra.Command, args []string) error { |
| 112 | if len(args) < 1 { |
| 113 | return fmt.Errorf("must pass a path to build") |
| 114 | } |
| 115 | |
| 116 | if c.Flag("output").Changed { |
| 117 | out, err := build.ParseOutput([]string{cmd.output}) |
| 118 | if err != nil || len(out) != 1 { |
| 119 | return err |
| 120 | } |
| 121 | if name, ok := out[0].Attrs["name"]; ok && name != "" { |
| 122 | validated, err := validateTag(name) |
| 123 | if err != nil { |
| 124 | return err |
| 125 | } |
| 126 | out[0].Attrs["name"] = validated |
| 127 | } |
| 128 | cmd.bkoutput = out[0] |
| 129 | } else if cmd.tags.Len() < 1 { |
| 130 | return errors.New("please specify an image tag with `-t` or an output spec with `-o`") |
| 131 | } |
| 132 | |
| 133 | return nil |
| 134 | } |
| 135 | |
| 136 | func (cmd *buildCommand) Run(args []string) (err error) { |
| 137 | reexec() |
nothing calls this directly
no test coverage detected