(args []string)
| 126 | } |
| 127 | |
| 128 | func (c *fileCmd) RunCommand(args []string) error { |
| 129 | if c.vivify { |
| 130 | if c.makePermanode || c.filePermanodes || c.tag != "" || c.title != "" { |
| 131 | return cmdmain.UsageError("--vivify excludes any other option") |
| 132 | } |
| 133 | } |
| 134 | if c.title != "" && !c.makePermanode { |
| 135 | return cmdmain.UsageError("Can't set title without using --permanode") |
| 136 | } |
| 137 | if c.tag != "" && !c.makePermanode && !c.filePermanodes { |
| 138 | return cmdmain.UsageError("Can't set tag without using --permanode or --filenodes") |
| 139 | } |
| 140 | if c.histo != "" && !c.memstats { |
| 141 | return cmdmain.UsageError("Can't use histo without memstats") |
| 142 | } |
| 143 | if c.deleteAfterUpload && !c.filePermanodes { |
| 144 | return cmdmain.UsageError("Can't set use --delete_after_upload without --filenodes") |
| 145 | } |
| 146 | if c.filePermanodes && c.contentsOnly { |
| 147 | return cmdmain.UsageError("--contents_only and --filenodes are exclusive. Use --permanode instead.") |
| 148 | } |
| 149 | |
| 150 | up := getUploader() |
| 151 | if c.memstats { |
| 152 | sr := new(statspkg.Receiver) |
| 153 | up.altStatReceiver = sr |
| 154 | defer func() { DumpStats(sr, c.histo) }() |
| 155 | } |
| 156 | c.initCaches(up) |
| 157 | |
| 158 | if c.makePermanode || c.filePermanodes { |
| 159 | testSigBlobRef := up.Client.SignerPublicKeyBlobref() |
| 160 | if !testSigBlobRef.Valid() { |
| 161 | return cmdmain.UsageError("A GPG key is needed to create permanodes; configure one or use vivify mode.") |
| 162 | } |
| 163 | } |
| 164 | up.fileOpts = &fileOptions{ |
| 165 | permanode: c.filePermanodes, |
| 166 | tag: c.tag, |
| 167 | vivify: c.vivify, |
| 168 | exifTime: c.exifTime, |
| 169 | capCtime: c.capCtime, |
| 170 | contentsOnly: c.contentsOnly, |
| 171 | } |
| 172 | |
| 173 | var ( |
| 174 | permaNode *client.PutResult |
| 175 | lastPut *client.PutResult |
| 176 | err error |
| 177 | ) |
| 178 | if c.makePermanode { |
| 179 | if len(args) != 1 { |
| 180 | return fmt.Errorf("The --permanode flag can only be used with exactly one file or directory argument") |
| 181 | } |
| 182 | permaNode, err = up.UploadNewPermanode(ctxbg) |
| 183 | if err != nil { |
| 184 | return fmt.Errorf("Uploading permanode: %v", err) |
| 185 | } |
nothing calls this directly
no test coverage detected