mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
add file recorder config
This commit is contained in:
parent
6e8ee94285
commit
6abab46db0
@ -226,6 +226,9 @@ func CmdConfig() cli.Command {
|
||||
if c.IsSet("local_addrs") {
|
||||
config.Config.SetLocalAddrs(c.String("local_addrs"))
|
||||
}
|
||||
if c.IsSet("file_record_config") {
|
||||
config.Config.SetFileRecorderConfig(c.String("file_record_config"))
|
||||
}
|
||||
|
||||
err := config.Config.Save()
|
||||
if err != nil {
|
||||
@ -276,6 +279,10 @@ func CmdConfig() cli.Command {
|
||||
Name: "local_addrs",
|
||||
Usage: "设置本地网卡地址, 多个地址用逗号隔开",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "file_record_config",
|
||||
Usage: "设置是否开启上传、下载、同步文件的结果记录功能",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -101,6 +101,7 @@ type PanConfig struct {
|
||||
UpdateCheckInfo UpdateCheckInfo `json:"updateCheckInfo"`
|
||||
|
||||
VideoFileExtensions string `json:"videoFileExtensions"`
|
||||
FileRecordConfig string `json:"fileRecordConfig"` // 上传、下载、同步文件的记录,包括失败和成功的
|
||||
|
||||
configFilePath string
|
||||
configFile *os.File
|
||||
@ -272,6 +273,7 @@ func (c *PanConfig) initDefaultConfig() {
|
||||
}
|
||||
c.ConfigVer = ConfigVersion
|
||||
c.VideoFileExtensions = DefaultVideoFileExtensions
|
||||
c.FileRecordConfig = "1" // 默认开启
|
||||
}
|
||||
|
||||
// GetConfigDir 获取配置路径
|
||||
|
@ -66,8 +66,20 @@ func (c *PanConfig) SetMaxUploadRateByStr(sizeStr string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFileRecorderConfig 设置文件记录器
|
||||
func (c *PanConfig) SetFileRecorderConfig(config string) error {
|
||||
if config == "1" || config == "2" {
|
||||
c.FileRecordConfig = config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PrintTable 输出表格
|
||||
func (c *PanConfig) PrintTable() {
|
||||
fileRecorderLabel := "禁用"
|
||||
if c.FileRecordConfig == "1" {
|
||||
fileRecorderLabel = "开启"
|
||||
}
|
||||
tb := cmdtable.NewTable(os.Stdout)
|
||||
tb.SetHeader([]string{"名称", "值", "建议值", "描述"})
|
||||
tb.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
|
||||
@ -82,6 +94,7 @@ func (c *PanConfig) PrintTable() {
|
||||
[]string{"savedir", c.SaveDir, "", "下载文件的储存目录"},
|
||||
[]string{"proxy", c.Proxy, "", "设置代理, 支持 http/socks5 代理,例如:http://127.0.0.1:8888"},
|
||||
[]string{"local_addrs", c.LocalAddrs, "", "设置本地网卡地址, 多个地址用逗号隔开,例如:127.0.0.1,192.168.100.126"},
|
||||
[]string{"file_record_config", fileRecorderLabel, "1-开启记录,2-禁用记录", "设置是否开启上传、下载、同步文件的结果记录,开启后会把结果记录到CSV文件方便后期查看状态"},
|
||||
})
|
||||
tb.Render()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user