Skip to content

Commit 0931cc4

Browse files
committed
feat: list news handler
1 parent 1110360 commit 0931cc4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use crate::api::auth::session;
99
use crate::api::ing::{Ing, IngType};
10+
use crate::api::news::News;
1011
use crate::api::post::Post;
1112
use crate::api::user::User;
1213
use crate::args::parser::no_operation;
@@ -129,6 +130,13 @@ async fn main() -> Result<()> {
129130
foe.then(||panic_if_err(&id));
130131
quiet.not().then(||display::update_post(style, &id));
131132
}
133+
_ if let Some((skip, take)) = parser::list_news(&args) => {
134+
let news_vec = try {
135+
News::new(pat?).get_list(skip, take).await?
136+
};
137+
foe.then(||panic_if_err(&news_vec));
138+
quiet.not().then(||display::list_news(style, &news_vec, rev));
139+
}
132140

133141
_ if no_operation(&args) => {
134142
Args::command().print_help()?;

0 commit comments

Comments
 (0)