mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
fs: Use --cutoff-mode hard,soft,catious instead of 3 --max-transfer-mode flags
Fixes #2672
This commit is contained in:
committed by
Nick Craig-Wood
parent
6f1766dd9e
commit
2b3d13a841
49
fs/cutoffmode.go
Normal file
49
fs/cutoffmode.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// CutoffMode describes the possible delete modes in the config
|
||||
type CutoffMode byte
|
||||
|
||||
// MaxTransferMode constants
|
||||
const (
|
||||
CutoffModeHard CutoffMode = iota
|
||||
CutoffModeSoft
|
||||
CutoffModeCautious
|
||||
CutoffModeDefault = CutoffModeHard
|
||||
)
|
||||
|
||||
var cutoffModeToString = []string{
|
||||
CutoffModeHard: "HARD",
|
||||
CutoffModeSoft: "SOFT",
|
||||
CutoffModeCautious: "CAUTIOUS",
|
||||
}
|
||||
|
||||
// String turns a LogLevel into a string
|
||||
func (m CutoffMode) String() string {
|
||||
if m >= CutoffMode(len(cutoffModeToString)) {
|
||||
return fmt.Sprintf("CutoffMode(%d)", m)
|
||||
}
|
||||
return cutoffModeToString[m]
|
||||
}
|
||||
|
||||
// Set a LogLevel
|
||||
func (m *CutoffMode) Set(s string) error {
|
||||
for n, name := range cutoffModeToString {
|
||||
if s != "" && name == strings.ToUpper(s) {
|
||||
*m = CutoffMode(n)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return errors.Errorf("Unknown cutoff mode %q", s)
|
||||
}
|
||||
|
||||
// Type of the value
|
||||
func (m *CutoffMode) Type() string {
|
||||
return "string"
|
||||
}
|
||||
Reference in New Issue
Block a user