forked from riba2534/feishu-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolve_comment.go
More file actions
83 lines (65 loc) · 2.06 KB
/
resolve_comment.go
File metadata and controls
83 lines (65 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package cmd
import (
"fmt"
"github.com/riba2534/feishu-cli/internal/client"
"github.com/riba2534/feishu-cli/internal/config"
"github.com/spf13/cobra"
)
var resolveCommentCmd = &cobra.Command{
Use: "resolve <file_token> <comment_id>",
Short: "标记评论为已解决",
Long: `将指定评论标记为已解决状态。
参数:
file_token 文档 Token
comment_id 评论 ID
示例:
feishu-cli comment resolve doccnXXX 6916106822734578184 --type docx`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
if err := config.Validate(); err != nil {
return err
}
fileToken := args[0]
commentID := args[1]
fileType, _ := cmd.Flags().GetString("type")
if err := client.PatchComment(fileToken, commentID, fileType, true); err != nil {
return err
}
fmt.Printf("评论已标记为已解决!\n")
fmt.Printf(" 文档 Token: %s\n", fileToken)
fmt.Printf(" 评论 ID: %s\n", commentID)
return nil
},
}
var unresolveCommentCmd = &cobra.Command{
Use: "unresolve <file_token> <comment_id>",
Short: "标记评论为未解决",
Long: `将指定评论标记为未解决状态。
参数:
file_token 文档 Token
comment_id 评论 ID
示例:
feishu-cli comment unresolve doccnXXX 6916106822734578184 --type docx`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
if err := config.Validate(); err != nil {
return err
}
fileToken := args[0]
commentID := args[1]
fileType, _ := cmd.Flags().GetString("type")
if err := client.PatchComment(fileToken, commentID, fileType, false); err != nil {
return err
}
fmt.Printf("评论已标记为未解决!\n")
fmt.Printf(" 文档 Token: %s\n", fileToken)
fmt.Printf(" 评论 ID: %s\n", commentID)
return nil
},
}
func init() {
commentCmd.AddCommand(resolveCommentCmd)
resolveCommentCmd.Flags().String("type", "docx", "文件类型(doc/docx/sheet/bitable)")
commentCmd.AddCommand(unresolveCommentCmd)
unresolveCommentCmd.Flags().String("type", "docx", "文件类型(doc/docx/sheet/bitable)")
}