Skip to main content

wekan_cli/commands/skill/
list.rs

1use clap::Args;
2
3use crate::command_result::{CommandSuccess, SkillListSuccess, SkillTopicSummary};
4
5use super::topics::TOPICS;
6
7#[derive(Debug, Args)]
8pub struct ListArgs {}
9
10pub(super) fn execute(_args: ListArgs) -> CommandSuccess {
11    let mut topics: Vec<_> = TOPICS
12        .iter()
13        .map(|topic| SkillTopicSummary {
14            name: topic.name.to_owned(),
15            description: topic.description.to_owned(),
16        })
17        .collect();
18    topics.sort_by(|a, b| a.name.cmp(&b.name));
19    CommandSuccess::SkillList(SkillListSuccess {
20        cli_version: env!("CARGO_PKG_VERSION").to_owned(),
21        topics,
22    })
23}