From 4c89bbc652b7bca5ad9e896746f580ecb11975e7 Mon Sep 17 00:00:00 2001 From: tickstep Date: Sat, 8 Jan 2022 22:16:24 +0800 Subject: [PATCH] user can specify share password for private share --- internal/command/share.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/command/share.go b/internal/command/share.go index 9699133..0d60cac 100644 --- a/internal/command/share.go +++ b/internal/command/share.go @@ -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" { - sharePwd = RandomStr(4) + 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: "", + }, }, }, {