mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-19 20:46:35 +00:00
Multiple ways to specify OSDK new's type
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
dcab4e1039
commit
3dce753c86
@ -97,16 +97,43 @@ pub struct ForwardedArguments {
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct NewArgs {
|
||||
#[arg(
|
||||
id = "type",
|
||||
long = "type",
|
||||
short = 't',
|
||||
default_value = "library",
|
||||
help = "The type of the project to create"
|
||||
help = "The type of the project to create",
|
||||
conflicts_with_all = ["kernel", "library"],
|
||||
)]
|
||||
pub type_: ProjectType,
|
||||
#[arg(
|
||||
long,
|
||||
help = "Create a kernel package",
|
||||
conflicts_with_all = ["library", "type"],
|
||||
)]
|
||||
pub kernel: bool,
|
||||
#[arg(
|
||||
long,
|
||||
alias = "lib",
|
||||
help = "Create a library package",
|
||||
conflicts_with_all = ["kernel", "type"],
|
||||
)]
|
||||
pub library: bool,
|
||||
#[arg(name = "name", required = true)]
|
||||
pub crate_name: String,
|
||||
}
|
||||
|
||||
impl NewArgs {
|
||||
pub fn project_type(&self) -> ProjectType {
|
||||
if self.kernel {
|
||||
ProjectType::Kernel
|
||||
} else if self.library {
|
||||
ProjectType::Library
|
||||
} else {
|
||||
self.type_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct BuildArgs {
|
||||
#[command(flatten)]
|
||||
|
Reference in New Issue
Block a user