(args []string)
| 68 | } |
| 69 | |
| 70 | func (c *putCmd) RunCommand(args []string) error { |
| 71 | err := c.checkFlags(args) |
| 72 | if err != nil { |
| 73 | return cmdmain.UsageError(fmt.Sprint(err)) |
| 74 | } |
| 75 | if !*noBuild { |
| 76 | if err := build(filepath.Join("cmd", "pk-put")); err != nil { |
| 77 | return fmt.Errorf("Could not build pk-put: %v", err) |
| 78 | } |
| 79 | } |
| 80 | c.env.SetCamdevVars(c.altkey) |
| 81 | // wipeCacheDir needs to be called after SetCamdevVars, because that is |
| 82 | // where CAMLI_CACHE_DIR is defined. |
| 83 | if *wipeCache { |
| 84 | c.env.wipeCacheDir() |
| 85 | } |
| 86 | |
| 87 | blobserver := "http://localhost:" + c.port + c.path |
| 88 | if c.tls { |
| 89 | blobserver = strings.Replace(blobserver, "http://", "https://", 1) |
| 90 | } |
| 91 | |
| 92 | cmdBin, err := osutil.LookPathGopath("pk-put") |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | cmdArgs := []string{ |
| 97 | "-verbose=" + strconv.FormatBool(*cmdmain.FlagVerbose || !quiet), |
| 98 | "-server=" + blobserver, |
| 99 | } |
| 100 | cmdArgs = append(cmdArgs, args...) |
| 101 | return runExec(cmdBin, cmdArgs, c.env) |
| 102 | } |
| 103 | |
| 104 | func (c *putCmd) checkFlags(args []string) error { |
| 105 | if _, err := strconv.ParseInt(c.port, 0, 0); err != nil { |
nothing calls this directly
no test coverage detected