()
| 73 | ) |
| 74 | |
| 75 | func init() { |
| 76 | cmdmain.RegisterMode("file", func(flags *flag.FlagSet) cmdmain.CommandRunner { |
| 77 | cmd := new(fileCmd) |
| 78 | flags.BoolVar(&cmd.makePermanode, "permanode", false, "Create and associate a new permanode for the uploaded file or directory.") |
| 79 | flags.BoolVar(&cmd.filePermanodes, "filenodes", false, "Create (if necessary) content-based permanodes for each uploaded file.") |
| 80 | flags.BoolVar(&cmd.deleteAfterUpload, "delete_after_upload", false, "If using -filenodes, deletes files once they're uploaded, or if they've already been uploaded.") |
| 81 | flags.BoolVar(&cmd.vivify, "vivify", false, |
| 82 | "If true, ask the server to create and sign permanode(s) associated with each uploaded"+ |
| 83 | " file. This permits the server to have your signing key. Used mostly with untrusted"+ |
| 84 | " or at-risk clients, such as phones.") |
| 85 | flags.BoolVar(&cmd.exifTime, "exiftime", false, "Try to use metadata (such as EXIF) to get a stable creation time. If found, used as the replacement for the modtime. Mainly useful with vivify or filenodes.") |
| 86 | flags.StringVar(&cmd.title, "title", "", "Optional title attribute to set on permanode when using -permanode.") |
| 87 | flags.StringVar(&cmd.tag, "tag", "", "Optional tag(s) to set on permanode when using -permanode or -filenodes. Single value or comma separated.") |
| 88 | |
| 89 | flags.BoolVar(&cmd.diskUsage, "du", false, "Dry run mode: only show disk usage information, without upload or statting dest. Used for testing ignoredFiles configs, mostly.") |
| 90 | |
| 91 | if debug, _ := strconv.ParseBool(os.Getenv("CAMLI_DEBUG")); debug { |
| 92 | flags.BoolVar(&cmd.statcache, "statcache", true, "(debug flag) Use the stat cache, assuming unchanged files already uploaded in the past are still there. Fast, but potentially dangerous.") |
| 93 | flags.BoolVar(&cmd.memstats, "debug-memstats", false, "(debug flag) Enter debug in-memory mode; collecting stats only. Doesn't upload anything.") |
| 94 | flags.StringVar(&cmd.histo, "debug-histogram-file", "", "(debug flag) Optional file to create and write the blob size for each file uploaded. For use with GNU R and hist(read.table(\"filename\")$V1). Requires debug-memstats.") |
| 95 | flags.BoolVar(&cmd.capCtime, "capctime", false, "(debug flag) For file blobs use file modification time as creation time if it would be bigger (newer) than modification time. For stable filenode creation (you can forge mtime, but can't forge ctime).") |
| 96 | flags.BoolVar(&flagUseSQLiteChildCache, "sqlitecache", false, "(debug flag) Use sqlite for the statcache and havecache instead of a flat cache.") |
| 97 | flags.BoolVar(&cmd.contentsOnly, "contents_only", false, "(debug flag) Do not store any of the file's attributes. We write only the file's contents (the blobRefs for its parts) to the created file schema.") |
| 98 | } else { |
| 99 | cmd.statcache = true |
| 100 | } |
| 101 | if android.IsChild() { |
| 102 | flags.BoolVar(&cmd.argsFromInput, "stdinargs", false, "If true, filenames to upload are sent one-per-line on stdin. EOF means to quit the process with exit status 0.") |
| 103 | // limit number of goroutines to limit memory |
| 104 | uploadWorkers = 2 |
| 105 | statCacheWorkers = 2 |
| 106 | } |
| 107 | |
| 108 | return cmd |
| 109 | }) |
| 110 | } |
| 111 | |
| 112 | func (c *fileCmd) Describe() string { |
| 113 | return "Upload file(s)." |
nothing calls this directly
no test coverage detected