Repository: rclone/rclone
File: fs/config/configflags/configflags.go (Go)

Code before:
		} else {
			log.Fatalf("--dscp: Invalid DSCP name: %v", dscp)
		}
	}

	// Set path to configuration file
	if err := config.SetConfigPath(configPath); err != nil {
		log.Fatalf("--config: Failed to set %q as config path: %v", configPath, err)
	}

	// Set path to cache dir
	if err := config.SetCacheDir(cacheDir); err != nil {
		log.Fatalf("--cache-dir: Failed to set %q as cache dir: %v", cacheDir, err)
	}

	// Set path to temp dir
	if err := config.SetTempDir(tempDir); err != nil {
		log.Fatalf("--temp-dir: Failed to set %q as temp dir: %v", tempDir, err)
	}

	// Set whether multi-thread-streams was set
	multiThreadStreamsFlag := pflag.Lookup("multi-thread-streams")
	ci.MultiThreadSet = multiThreadStreamsFlag != nil && multiThreadStreamsFlag.Changed

	partialUploadExtension = strings.TrimSpace(partialUploadExtension)
	if len(partialUploadExtension) < 1 || len(partialUploadExtension) > 15 {
		log.Fatalf("--partial-upload-extension: Expecting extension length between %d and %d but got %d", 1, 15, len(partialUploadExtension))
	}
	ci.PartialUploadExtension = partialUploadExtension

	// Make sure some values are > 0
	nonZero := func(pi *int) {
		if *pi <= 0 {
			*pi = 1
		}
	}
	nonZero(&ci.LowLevelRetries)
	nonZero(&ci.Transfers)
	nonZero(&ci.Checkers)
}

// parseHeaders converts DSCP names to value
func parseDSCP(dscp string) (uint8, bool) {
	if s, err := strconv.ParseUint(dscp, 10, 6); err == nil {
		return uint8(s), true
	}
	dscp = strings.ToUpper(dscp)
	switch dscp {
	case "BE":
		fallthrough
	case "DF":

Review comment (suggestion):
Just looking at rclone's other options, it would be more consistent to call this `--partial-suffix`

Also upload is inaccurate since these are used for downloads to local, so let's leave it out.

So the default should be `.partial` and an empty string is acceptable.

Code after:
		} else {
			log.Fatalf("--dscp: Invalid DSCP name: %v", dscp)
		}
	}

	// Set path to configuration file
	if err := config.SetConfigPath(configPath); err != nil {
		log.Fatalf("--config: Failed to set %q as config path: %v", configPath, err)
	}

	// Set path to cache dir
	if err := config.SetCacheDir(cacheDir); err != nil {
		log.Fatalf("--cache-dir: Failed to set %q as cache dir: %v", cacheDir, err)
	}

	// Set path to temp dir
	if err := config.SetTempDir(tempDir); err != nil {
		log.Fatalf("--temp-dir: Failed to set %q as temp dir: %v", tempDir, err)
	}

	// Set whether multi-thread-streams was set
	multiThreadStreamsFlag := pflag.Lookup("multi-thread-streams")
	ci.MultiThreadSet = multiThreadStreamsFlag != nil && multiThreadStreamsFlag.Changed

	if len(partialSuffix) > 16 {
		log.Fatalf("--partial-suffix: Expecting suffix length not greater than %d but got %d", 16, len(partialSuffix))
	}
	ci.PartialSuffix = partialSuffix

	// Make sure some values are > 0
	nonZero := func(pi *int) {
		if *pi <= 0 {
			*pi = 1
		}
	}
	nonZero(&ci.LowLevelRetries)
	nonZero(&ci.Transfers)
	nonZero(&ci.Checkers)
}

// parseHeaders converts DSCP names to value
func parseDSCP(dscp string) (uint8, bool) {
	if s, err := strconv.ParseUint(dscp, 10, 6); err == nil {
		return uint8(s), true
	}
	dscp = strings.ToUpper(dscp)
	switch dscp {
	case "BE":
		fallthrough
	case "DF":
		fallthrough