xref: /DADK/dadk/src/console/mod.rs (revision a013ae121c339d37b6fa5273770148fa161c730b)
1 use clap::{Parser, Subcommand};
2 use rootfs::RootFSCommand;
3 use user::UserCommand;
4 
5 pub mod rootfs;
6 #[cfg(test)]
7 mod tests;
8 pub mod user;
9 
10 #[derive(Debug, Parser, Clone)]
11 #[command(author, version, about)]
12 pub struct CommandLineArgs {
13     /// 要执行的操作
14     #[command(subcommand)]
15     pub action: Action,
16 
17     /// dadk manifest 配置文件的路径
18     #[arg(
19         short = 'f',
20         long = "manifest",
21         default_value = "dadk-manifest.toml",
22         global = true
23     )]
24     pub manifest_path: String,
25 
26     /// DADK 的工作目录
27     #[arg(short = 'w', long = "workdir", default_value = ".", global = true)]
28     pub workdir: String,
29 }
30 
31 #[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
32 pub enum Action {
33     /// 内核相关操作
34     Kernel,
35     /// 对 rootfs 进行操作
36     #[command(subcommand, name = "rootfs")]
37     Rootfs(RootFSCommand),
38     /// 用户程序构建相关操作
39     #[command(subcommand, name = "user")]
40     User(UserCommand),
41 }
42