@@ -2,42 +2,44 @@ use clap::{Parser, Subcommand};
2
2
3
3
#[ derive( Parser , Debug ) ]
4
4
pub struct Opt {
5
- #[ arg ( verbatim_doc_comment) ]
5
+ #[ clap ( verbatim_doc_comment) ]
6
6
/// Show title and content of a specific post
7
- /// Example: cnb --id 114514 post --show
8
- /// You should also specify the id of the post via --id
7
+ /// Example: cnb --id 114514 post --show
8
+ /// You should also specify the id of the post via --id
9
9
#[ arg( long) ]
10
10
#[ arg( short = 's' ) ]
11
11
pub show : bool ,
12
12
13
13
#[ arg( verbatim_doc_comment) ]
14
14
/// Show metadata of a specific post
15
- /// Example: cnb --id 114514 post --show-meta
16
- /// You should also specify the id of the post via --id
15
+ /// Example: cnb --id 114514 post --show-meta
16
+ /// You should also specify the id of the post via --id
17
17
#[ arg( long) ]
18
18
#[ arg( short = 'm' ) ]
19
19
pub show_meta : bool ,
20
20
21
21
#[ arg( verbatim_doc_comment) ]
22
22
/// Show post list, order by time in DESC
23
- /// Example: cnb post --list
24
- /// <LENGTH> should in range [0,100]
25
- /// If <LENGTH> greater than 100, it will be set to 100
23
+ /// Example: cnb post --list
24
+ /// <LENGTH> should in range [0,100]
25
+ /// If <LENGTH> greater than 100, it will be set to 100
26
26
#[ arg( long) ]
27
27
#[ arg( short = 'l' ) ]
28
28
pub list : bool ,
29
29
30
30
#[ arg( verbatim_doc_comment) ]
31
31
/// Delete post
32
- /// Example: cnb --id 114514 post --delete
33
- /// You should also specify the id of the post via --id
32
+ /// Example: cnb --id 114514 post --delete
33
+ /// You should also specify the id of the post via --id
34
+ /// *
34
35
#[ arg( long) ]
35
36
#[ arg( visible_alias = "del" ) ]
36
37
pub delete : bool ,
37
38
38
39
#[ arg( verbatim_doc_comment) ]
39
40
/// Search post by keyword and output the post id list that matches
40
- /// Example: cnb post --search 'Hello world'
41
+ /// Example: cnb post --search 'Hello world'
42
+ /// *
41
43
#[ arg( long) ]
42
44
#[ arg( short = 'f' ) ]
43
45
#[ arg( visible_alias = "find" ) ]
@@ -50,53 +52,59 @@ pub struct Opt {
50
52
51
53
#[ derive( Debug , Subcommand ) ]
52
54
pub enum Cmd {
55
+ #[ clap( verbatim_doc_comment) ]
53
56
/// Create post
54
57
/// Example: cnb post create --title 'Title' --body 'Body'
58
+ /// *
55
59
#[ clap( visible_alias = "c" ) ]
56
60
Create {
57
61
#[ arg( verbatim_doc_comment) ]
58
62
/// Set post title
59
- /// Example: cnb post create --title 'Title' --body 'Body'
63
+ /// Example: cnb post create --title 'Title' --body 'Body'
60
64
#[ arg( long) ]
61
65
#[ arg( value_name = "TITLE" ) ]
62
66
title : String ,
63
67
64
68
#[ arg( verbatim_doc_comment) ]
65
69
/// Set post body
66
- /// Example: cnb post create --title 'Title' --body 'Body'
70
+ /// Example: cnb post create --title 'Title' --body 'Body'
67
71
#[ arg( long) ]
68
72
#[ arg( value_name = "BODY" ) ]
69
73
body : String ,
70
74
71
75
#[ arg( verbatim_doc_comment) ]
72
76
/// Set post status to publish
73
- /// Example: cnb post create --title 'Title' --body 'Body' --publish
77
+ /// Example: cnb post create --title 'Title' --body 'Body' --publish
78
+ /// *
74
79
#[ arg( long) ]
75
80
#[ arg( visible_alias = "pub" ) ]
76
81
publish : bool ,
77
82
} ,
83
+ #[ clap( verbatim_doc_comment) ]
78
84
/// Update post
79
85
/// Example: cnb --id 114514 post update --title 'Title'
80
- /// You should also specify the id of the post via --id
86
+ /// You should also specify the id of the post via --id
87
+ /// *
81
88
#[ clap( visible_alias = "u" ) ]
82
89
Update {
83
90
#[ arg( verbatim_doc_comment) ]
84
91
/// Set post title
85
- /// Example: cnb --id 114514 post update --title 'Title'
92
+ /// Example: cnb --id 114514 post update --title 'Title'
86
93
#[ arg( long) ]
87
94
#[ arg( value_name = "TITLE" ) ]
88
95
title : Option < String > ,
89
96
90
97
#[ arg( verbatim_doc_comment) ]
91
98
/// Set post body
92
- /// Example: cnb --id 114514 post update --body 'Body'
99
+ /// Example: cnb --id 114514 post update --body 'Body'
93
100
#[ arg( long) ]
94
101
#[ arg( value_name = "BODY" ) ]
95
102
body : Option < String > ,
96
103
97
104
#[ arg( verbatim_doc_comment) ]
98
105
/// Set post publish state
99
- /// Example: cnb --id 114514 post update --publish true
106
+ /// Example: cnb --id 114514 post update --publish true
107
+ /// *
100
108
#[ arg( long) ]
101
109
#[ arg( value_name = "BOOL" ) ]
102
110
#[ arg( visible_alias = "pub" ) ]
0 commit comments