@@ -46,16 +46,6 @@ pub struct Opt {
4646 #[ arg( visible_alias = "del" ) ]
4747 pub delete : bool ,
4848
49- #[ arg( verbatim_doc_comment) ]
50- /// Search self post by keyword and output the post id list that matches
51- /// Example: cnb post --search-self 'Hello world'
52- /// *
53- #[ arg( long) ]
54- #[ arg( visible_alias = "f-self" ) ]
55- #[ arg( visible_alias = "find-self" ) ]
56- #[ arg( value_name = "KEYWORD" ) ]
57- pub search_self : Option < String > ,
58-
5949 #[ command( subcommand) ]
6050 pub cmd : Option < Cmd > ,
6151}
@@ -111,6 +101,17 @@ pub struct UpdateCmd {
111101 pub publish : Option < bool > ,
112102}
113103
104+ #[ derive( Parser , Debug ) ]
105+ pub struct SearchCmd {
106+ #[ arg( verbatim_doc_comment) ]
107+ /// Search self post
108+ /// Example: cnb post search --self 'Keyword'
109+ #[ arg( long) ]
110+ #[ arg( long = "self" ) ]
111+ #[ arg( value_name = "KEYWORD" ) ]
112+ pub self_keyword : Option < String > ,
113+ }
114+
114115#[ derive( Debug , Subcommand ) ]
115116pub enum Cmd {
116117 #[ clap( verbatim_doc_comment) ]
@@ -119,11 +120,19 @@ pub enum Cmd {
119120 /// *
120121 #[ clap( visible_alias = "c" ) ]
121122 Create ( CreateCmd ) ,
123+
122124 #[ clap( verbatim_doc_comment) ]
123125 /// Update post
124126 /// Example: cnb --id 114514 post update --title 'Title'
125127 /// You should also specify the id of the post via --id
126128 /// *
127129 #[ clap( visible_alias = "u" ) ]
128130 Update ( UpdateCmd ) ,
131+
132+ #[ clap( verbatim_doc_comment) ]
133+ /// Search post
134+ /// Example: cnb post search --self 'Keyword'
135+ /// *
136+ #[ clap( visible_alias = "s" ) ]
137+ Search ( SearchCmd ) ,
129138}
0 commit comments