From df0bdbd7ed7f03c7fd1c496f111857e33c60d25d Mon Sep 17 00:00:00 2001 From: Jianan Date: Fri, 19 May 2023 17:11:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feature:=E4=B8=8A=E4=BC=A0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0--save-uploaded-file=20=20--suf=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=8C=87=E5=AE=9A=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=9D=E5=AD=98=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/rio_api.go | 1 + main.go | 14 ++++++++++++-- utils/save_file.go | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/api/rio_api.go b/api/rio_api.go index 50dcfbe..37bda9f 100644 --- a/api/rio_api.go +++ b/api/rio_api.go @@ -30,6 +30,7 @@ type FirApi struct { QrCodePngNeed bool QrCodeAsciiNeed bool SaveUploadedInfo bool + SaveUploadedPath string ApiAppInfo *ApiAppInfo uploadAppService *analysis.UploadAppService appFileInfo *analysis.AppFileInfo diff --git a/main.go b/main.go index ed556fa..479d664 100644 --- a/main.go +++ b/main.go @@ -159,7 +159,12 @@ func uploadFile() cli.Command { cli.BoolFlag{ Name: "save-uploaded-info, sui", - Usage: "上传成功后, 保存上传信息到本地 go-fir-cli-answer.json, 用于用户的其他集成操作, 默认为 false", + Usage: "上传成功后, 保存上传信息到本地json文件(默认为go-fir-cli-answer.json), 用于用户的其他集成操作, 默认为 false", + }, + + cli.StringFlag{ + Name: "save-uploaded-file, suf", + Usage: "指定上传成功后, 保存的上传文件路径,默认为当前目录的go-fir-cli-answer.json", }, cli.StringFlag{ @@ -242,6 +247,7 @@ func uploadFile() cli.Command { QrCodePngNeed: c.Bool("qrcode"), QrCodeAsciiNeed: c.Bool("qrcodeascii"), SaveUploadedInfo: c.Bool("save-uploaded-info"), + SaveUploadedPath: c.String("save-uploaded-file"), } api.Upload(file) @@ -256,7 +262,11 @@ func uploadFile() cli.Command { } if api.SaveUploadedInfo { - utils.SaveAnswer(api.ApiAppInfo) + if api.SaveUploadedPath != "" { + utils.SaveAnswer(api.SaveUploadedPath, api.ApiAppInfo) + } else { + utils.SaveAnswer("go-fir-cli-answer.json", api.ApiAppInfo) + } } if c.String("dingtalkToken") != "" { diff --git a/utils/save_file.go b/utils/save_file.go index a29f909..6d9b2a5 100644 --- a/utils/save_file.go +++ b/utils/save_file.go @@ -8,7 +8,7 @@ import ( "github.com/PGYER/go-fir-cli/api" ) -func SaveAnswer(apiAppInfo *api.ApiAppInfo) error { +func SaveAnswer(filePath string, apiAppInfo *api.ApiAppInfo) error { // fileName := "fir-cli-answer.json" data := make(map[string]string) @@ -23,7 +23,7 @@ func SaveAnswer(apiAppInfo *api.ApiAppInfo) error { json, _ := json.Marshal(data) // 将 data 转化为 json 后存储到本地answer.json 中 - ioutil.WriteFile("go-fir-cli-answer.json", json, 0644) + ioutil.WriteFile(filePath, json, 0644) return nil } From 1f4a127dbdf1b629a7fe9bea37b16956b814141d Mon Sep 17 00:00:00 2001 From: JiCheng Date: Fri, 4 Aug 2023 10:11:11 +0800 Subject: [PATCH 2/2] Update go_fir_cli_build.yml --- .github/workflows/go_fir_cli_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_fir_cli_build.yml b/.github/workflows/go_fir_cli_build.yml index e350fe4..ae68d94 100644 --- a/.github/workflows/go_fir_cli_build.yml +++ b/.github/workflows/go_fir_cli_build.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: wangyoucao577/go-release-action@v1.34 + - uses: wangyoucao577/go-release-action@v1.38 with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }}