MCPcopy Create free account
hub / github.com/dropbox/dbxcli / parsePutOptions

Function parsePutOptions

cmd/put.go:444–478  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

442}
443
444func parsePutOptions(cmd *cobra.Command) (putOptions, error) {
445 chunkSize, err := cmd.Flags().GetInt64("chunksize")
446 if err != nil {
447 return putOptions{}, err
448 }
449 if chunkSize < putChunkSizeUnit {
450 return putOptions{}, invalidArgumentsErrorWithDetails("`put` requires chunk size to be at least 4MiB", flagErrorDetails("chunksize"))
451 }
452 if chunkSize%putChunkSizeUnit != 0 {
453 return putOptions{}, invalidArgumentsErrorWithDetails("`put` requires chunk size to be a multiple of 4MiB", flagErrorDetails("chunksize"))
454 }
455 if chunkSize > putMaxChunkSize {
456 return putOptions{}, invalidArgumentsErrorWithDetails("`put` requires chunk size to be no more than 128MiB", flagErrorDetails("chunksize"))
457 }
458 workers, err := cmd.Flags().GetInt("workers")
459 if err != nil {
460 return putOptions{}, err
461 }
462 if workers < 1 {
463 workers = 1
464 }
465 debug, _ := cmd.Flags().GetBool("debug")
466 ifExists, err := parsePutIfExists(cmd)
467 if err != nil {
468 return putOptions{}, err
469 }
470 return putOptions{
471 chunkSize: chunkSize,
472 workers: workers,
473 debug: debug,
474 ifExists: ifExists,
475 output: commandOutput(cmd),
476 errOut: cmd.ErrOrStderr(),
477 }, nil
478}
479
480func parsePutIfExists(cmd *cobra.Command) (string, error) {
481 ifExists, err := cmd.Flags().GetString("if-exists")

Callers 3

putFunction · 0.85

Calls 4

flagErrorDetailsFunction · 0.85
parsePutIfExistsFunction · 0.85
commandOutputFunction · 0.85

Tested by 2