@@ -53,88 +53,88 @@ async fn main() -> Result<()> {
53
53
match args {
54
54
_ if let Some ( pat) = parser:: login ( & args) => {
55
55
let cfg_path = session:: login ( pat) ;
56
- foe. then ( ||panic_if_err ( & cfg_path) ) ;
57
- quiet. not ( ) . then ( ||display:: login ( style, & cfg_path) ) ;
56
+ foe. then ( || panic_if_err ( & cfg_path) ) ;
57
+ quiet. not ( ) . then ( || display:: login ( style, & cfg_path) ) ;
58
58
}
59
59
_ if parser:: logout ( & args) => {
60
60
let cfg_path = & session:: logout ( ) ;
61
- foe. then ( ||panic_if_err ( cfg_path) ) ;
62
- quiet. not ( ) . then ( ||display:: logout ( style, cfg_path) ) ;
61
+ foe. then ( || panic_if_err ( cfg_path) ) ;
62
+ quiet. not ( ) . then ( || display:: logout ( style, cfg_path) ) ;
63
63
}
64
64
_ if parser:: user_info ( & args) => {
65
65
let user_info = try {
66
66
User :: new ( pat?) . get_info ( ) . await ?
67
67
} ;
68
- foe. then ( ||panic_if_err ( & user_info) ) ;
69
- quiet. not ( ) . then ( ||display:: user_info ( style, & user_info) ) ;
68
+ foe. then ( || panic_if_err ( & user_info) ) ;
69
+ quiet. not ( ) . then ( || display:: user_info ( style, & user_info) ) ;
70
70
}
71
- _ if let Some ( ( skip, take, r#type) ) = parser:: list_ing ( & args) => {
71
+ _ if let Some ( ( skip, take, r#type, align ) ) = parser:: list_ing ( & args) => {
72
72
let ing_vec = try {
73
73
Ing :: new ( pat?) . get_list ( skip, take, & r#type) . await ?
74
74
} ;
75
- foe. then ( ||panic_if_err ( & ing_vec) ) ;
76
- quiet. not ( ) . then ( ||display:: list_ing ( style, & ing_vec, rev) ) ;
75
+ foe. then ( || panic_if_err ( & ing_vec) ) ;
76
+ quiet. not ( ) . then ( || display:: list_ing ( style, & ing_vec, rev, align ) ) ;
77
77
}
78
78
_ if let Some ( content) = parser:: publish_ing ( & args) => {
79
79
let content = try {
80
80
Ing :: new ( pat?) . publish ( content) . await ?;
81
81
content
82
82
} ;
83
- foe. then ( ||panic_if_err ( & content) ) ;
84
- quiet. not ( ) . then ( ||display:: publish_ing ( style, & content) ) ;
83
+ foe. then ( || panic_if_err ( & content) ) ;
84
+ quiet. not ( ) . then ( || display:: publish_ing ( style, & content) ) ;
85
85
}
86
- _ if let Some ( ( content, id) ) = parser:: comment_ing ( & args) => {
86
+ _ if let Some ( ( content, id) ) = parser:: comment_ing ( & args) => {
87
87
let content = try {
88
88
Ing :: new ( pat?) . comment ( id, content. clone ( ) , None , None ) . await ?;
89
89
content
90
90
} ;
91
- foe. then ( ||panic_if_err ( & content) ) ;
92
- quiet. not ( ) . then ( ||display:: comment_ing ( style, & content) ) ;
91
+ foe. then ( || panic_if_err ( & content) ) ;
92
+ quiet. not ( ) . then ( || display:: comment_ing ( style, & content) ) ;
93
93
}
94
94
_ if let Some ( id) = parser:: show_post ( & args) => {
95
95
let entry = try { Post :: new ( pat?) . get_one ( id) . await ? } ;
96
- foe. then ( ||panic_if_err ( & entry) ) ;
97
- quiet. not ( ) . then ( ||display:: show_post ( style, & entry) ) ;
96
+ foe. then ( || panic_if_err ( & entry) ) ;
97
+ quiet. not ( ) . then ( || display:: show_post ( style, & entry) ) ;
98
98
}
99
99
_ if let Some ( id) = parser:: show_post_meta ( & args) => {
100
100
let entry = try { Post :: new ( pat?) . get_one ( id) . await ? } ;
101
- foe. then ( ||panic_if_err ( & entry) ) ;
102
- quiet. not ( ) . then ( ||display:: show_post_meta ( style, & entry) ) ;
101
+ foe. then ( || panic_if_err ( & entry) ) ;
102
+ quiet. not ( ) . then ( || display:: show_post_meta ( style, & entry) ) ;
103
103
}
104
104
_ if let Some ( ( skip, take) ) = parser:: list_post ( & args) => {
105
105
let result = try { Post :: new ( pat?) . get_meta_list ( skip, take) . await ? } ;
106
- foe. then ( ||panic_if_err ( & result) ) ;
107
- quiet. not ( ) . then ( ||display:: list_post ( style, & result, rev) ) ;
106
+ foe. then ( || panic_if_err ( & result) ) ;
107
+ quiet. not ( ) . then ( || display:: list_post ( style, & result, rev) ) ;
108
108
}
109
109
_ if let Some ( id) = parser:: delete_post ( & args) => {
110
110
let id = try {
111
111
Post :: new ( pat?) . del_one ( id) . await ?;
112
112
id
113
113
} ;
114
- foe. then ( ||panic_if_err ( & id) ) ;
115
- quiet. not ( ) . then ( ||display:: delete_post ( style, & id) ) ;
114
+ foe. then ( || panic_if_err ( & id) ) ;
115
+ quiet. not ( ) . then ( || display:: delete_post ( style, & id) ) ;
116
116
}
117
117
_ if let Some ( ( kw, skip, take) ) = parser:: search_post ( & args) => {
118
118
let result = try { Post :: new ( pat?) . search ( skip, take, kw) . await ? } ;
119
- foe. then ( ||panic_if_err ( & result) ) ;
120
- quiet. not ( ) . then ( ||display:: search_post ( style, & result, rev) ) ;
119
+ foe. then ( || panic_if_err ( & result) ) ;
120
+ quiet. not ( ) . then ( || display:: search_post ( style, & result, rev) ) ;
121
121
}
122
122
_ if let Some ( ( title, body, publish) ) = parser:: create_post ( & args) => {
123
123
let id = try { Post :: new ( pat?) . create ( title, body, publish) . await ? } ;
124
- foe. then ( ||panic_if_err ( & id) ) ;
125
- quiet. not ( ) . then ( ||display:: create_post ( style, & id) ) ;
124
+ foe. then ( || panic_if_err ( & id) ) ;
125
+ quiet. not ( ) . then ( || display:: create_post ( style, & id) ) ;
126
126
}
127
127
_ if let Some ( ( id, title, body, publish) ) = parser:: update_post ( & args) => {
128
- let id = try { Post :: new ( pat?) . update ( id, title, body, publish) . await ? } ;
129
- foe. then ( ||panic_if_err ( & id) ) ;
130
- quiet. not ( ) . then ( ||display:: update_post ( style, & id) ) ;
128
+ let id = try { Post :: new ( pat?) . update ( id, title, body, publish) . await ? } ;
129
+ foe. then ( || panic_if_err ( & id) ) ;
130
+ quiet. not ( ) . then ( || display:: update_post ( style, & id) ) ;
131
131
}
132
132
_ if let Some ( ( skip, take) ) = parser:: list_news ( & args) => {
133
133
let news_vec = try {
134
134
News :: new ( pat?) . get_list ( skip, take) . await ?
135
135
} ;
136
- foe. then ( ||panic_if_err ( & news_vec) ) ;
137
- quiet. not ( ) . then ( ||display:: list_news ( style, & news_vec, rev) ) ;
136
+ foe. then ( || panic_if_err ( & news_vec) ) ;
137
+ quiet. not ( ) . then ( || display:: list_news ( style, & news_vec, rev) ) ;
138
138
}
139
139
140
140
_ if no_operation ( & args) => {
0 commit comments