fs: Add --stats-file-name-length to specify the printed file name length for stats

Fixes #1206
s3-about
Will Gunn 2018-01-10 15:32:36 -05:00 committed by Nick Craig-Wood
parent 57f1bb7bb2
commit 5c7e8d5a2b
2 changed files with 8 additions and 3 deletions

View File

@ -572,9 +572,11 @@ func (acc *Account) String() string {
}
}
name := []rune(acc.name)
if len(name) > 40 {
where := len(name) - 37
name = append([]rune{'.', '.', '.'}, name[where:]...)
if Config.StatsFileNameLength > 0 {
if len(name) > Config.StatsFileNameLength {
where := len(name) - Config.StatsFileNameLength
name = append([]rune{'.', '.', '.'}, name[where:]...)
}
}
if Config.DataRateUnit == "bits" {

View File

@ -114,6 +114,7 @@ var (
userAgent = StringP("user-agent", "", "rclone/"+Version, "Set the user-agent to a specified string. The default is rclone/ version")
immutable = BoolP("immutable", "", false, "Do not modify files. Fail if existing files have been modified.")
autoConfirm = BoolP("auto-confirm", "", false, "If enabled, do not request console confirmation.")
statsFileNameLength = IntP("stats-file-name-length", "", 40, "Max file name length in stats. 0 for no limit")
streamingUploadCutoff = SizeSuffix(100 * 1024)
dump DumpFlags
logLevel = LogLevelNotice
@ -255,6 +256,7 @@ type ConfigInfo struct {
Immutable bool
AutoConfirm bool
StreamingUploadCutoff SizeSuffix
StatsFileNameLength int
}
// Return the path to the configuration file
@ -392,6 +394,7 @@ func LoadConfig() {
Config.TPSLimitBurst = *tpsLimitBurst
Config.Immutable = *immutable
Config.AutoConfirm = *autoConfirm
Config.StatsFileNameLength = *statsFileNameLength
Config.BufferSize = bufferSize
Config.StreamingUploadCutoff = streamingUploadCutoff
Config.Dump = dump