mod.rs 877 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. use clap::{Parser, Subcommand};
  2. use rootfs::RootFSCommand;
  3. use user::UserCommand;
  4. pub mod rootfs;
  5. #[cfg(test)]
  6. mod tests;
  7. pub mod user;
  8. #[derive(Debug, Parser, Clone)]
  9. #[command(author, version, about)]
  10. pub struct CommandLineArgs {
  11. /// 要执行的操作
  12. #[command(subcommand)]
  13. pub action: Action,
  14. /// dadk manifest 配置文件的路径
  15. #[arg(
  16. short = 'f',
  17. long = "manifest",
  18. default_value = "dadk-manifest.toml",
  19. global = true
  20. )]
  21. pub manifest_path: String,
  22. /// DADK 的工作目录
  23. #[arg(short = 'w', long = "workdir", default_value = ".", global = true)]
  24. pub workdir: String,
  25. }
  26. #[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
  27. pub enum Action {
  28. Kernel,
  29. #[command(subcommand, name = "rootfs")]
  30. Rootfs(RootFSCommand),
  31. #[command(subcommand, name = "user")]
  32. User(UserCommand),
  33. }