leetcode_cli/cmds/mod.rs
1//! All subcommands in leetcode-cli
2//!
3//! ```sh
4//! SUBCOMMANDS:
5//! data Manage Cache [aliases: d]
6//! edit Edit question by id [aliases: e]
7//! list List problems [aliases: l]
8//! pick Pick a problem [aliases: p]
9//! stat Show simple chart about submissions [aliases: s]
10//! test Edit question by id [aliases: t]
11//! help Prints this message or the help of the given subcommand(s)
12//! ```
13use crate::err::Error;
14use async_trait::async_trait;
15use clap::{ArgMatches, Command as ClapCommand};
16
17/// Abstract commands' trait.
18#[async_trait]
19pub trait Command {
20 /// Usage of the specific command
21 fn usage() -> ClapCommand;
22
23 /// The handler will deal [args, options,...] from the command-line
24 async fn handler(m: &ArgMatches) -> Result<(), Error>;
25}
26
27mod completions;
28mod data;
29mod edit;
30mod exec;
31mod list;
32mod pick;
33mod stat;
34mod test;
35pub use completions::{completion_handler, CompletionCommand};
36pub use data::DataCommand;
37pub use edit::EditCommand;
38pub use exec::ExecCommand;
39pub use list::ListCommand;
40pub use pick::PickCommand;
41pub use stat::StatCommand;
42pub use test::TestCommand;