xref: /DADK/dadk/src/console/mod.rs (revision eaa67f3cf8881c221a744937c6318444b068a801)
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     Kernel,
34     #[command(subcommand, name = "rootfs")]
35     Rootfs(RootFSCommand),
36     #[command(subcommand, name = "user")]
37     User(UserCommand),
38 }
39