user can specify share password for private share

This commit is contained in:
tickstep 2022-01-08 22:16:24 +08:00
parent 4cf51f24fe
commit 4c89bbc652

View File

@ -50,6 +50,9 @@ func CmdShare() cli.Command {
创建文件 1.mp4 的分享链接
aliyunpan share set 1.mp4
创建文件 1.mp4 的分享链接并指定分享密码为2333
aliyunpan share set -sharePwd 2333 1.mp4
创建文件 1.mp4 的分享链接并指定有效期为1天
aliyunpan share set -time 1 1.mp4
`,
@ -77,12 +80,18 @@ func CmdShare() cli.Command {
}
sharePwd := ""
if c.IsSet("sharePwd") {
sharePwd = c.String("sharePwd")
}
modeFlag := "1"
if c.IsSet("mode") {
modeFlag = c.String("mode")
}
if modeFlag == "1" {
if sharePwd == "" {
sharePwd = RandomStr(4)
}
} else {
sharePwd = ""
}
@ -105,6 +114,11 @@ func CmdShare() cli.Command {
Usage: "有效期1-私密分享2-公开分享",
Value: "1",
},
cli.StringFlag{
Name: "sharePwd",
Usage: "自定义私密分享密码4个字符没有指定则随机生成",
Value: "",
},
},
},
{