增加一些文档说明,即注释
Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
This commit is contained in:
parent
b0cadbfee8
commit
653c68b30f
11
src/cli.rs
11
src/cli.rs
|
@ -19,6 +19,7 @@ pub enum CliSub {
|
|||
Db(SaDbCli),
|
||||
}
|
||||
|
||||
/// ConvertCli 用于将指定的 cvrf 格式 xml 文件转换为 cusa 格式
|
||||
#[derive(Clone, Debug, Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct ConvertCli {
|
||||
|
@ -36,6 +37,16 @@ pub struct ConvertCli {
|
|||
pub print: bool,
|
||||
}
|
||||
|
||||
impl ConvertCli {
|
||||
pub fn new(input: String, output: Option<String>, print: bool) -> Self {
|
||||
ConvertCli {
|
||||
input,
|
||||
output,
|
||||
print,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct SaDbCli {
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -27,6 +27,24 @@ pub fn cumain() -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// 可使用 convert 函数将 cvrf 格式文件转换并输出至指定的 cusa 文件。
|
||||
///
|
||||
/// 例:
|
||||
///
|
||||
/// ```no_run
|
||||
/// use cvrf2cusa::cli::ConvertCli
|
||||
///
|
||||
/// let cli = ConvertCli::new(
|
||||
/// // input
|
||||
/// "xxx-cvrf.xml".to_string,
|
||||
/// // output
|
||||
/// Some("pkg_version_said.json".to_string),
|
||||
/// // print to screen
|
||||
/// false,
|
||||
/// );
|
||||
///
|
||||
/// cvrf2cusa::Convert(cli)?;
|
||||
/// ```
|
||||
pub fn covert(cli: &cli::ConvertCli) -> Result<()> {
|
||||
// 检查 input,此为必须项
|
||||
let input = Path::new(&cli.input);
|
||||
|
|
Loading…
Reference in New Issue
Block a user