Merge branch 'master' into templates

This commit is contained in:
Demonthos authored and GitHub committed 2022-10-02 07:12:14 -05:00
commit 46d46b139a
11 files changed
+47 -40

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ impl Build {
crate::builder::build_desktop(&crate_config, false)?;
}
_ => {
return custom_error!("Unsoppurt platform target.");
return custom_error!("Unsupported platform target.");
}
}
+1 -2
View File
@@ -16,8 +16,7 @@ impl Clean {
.output()?;
if !output.status.success() {
log::error!("Cargo clean failed.");
return Ok(());
return custom_error!("Cargo clean failed.");
}
let out_dir = crate_config
+1 -2
View File
@@ -17,8 +17,7 @@ pub struct Create {
impl Create {
pub fn create(self) -> Result<()> {
if Self::name_vaild_check(self.name.clone()) {
log::error!("❗Unsupported project name.");
return Ok(());
return custom_error!("❗Unsupported project name.");
}
let project_path = PathBuf::from(&self.name);
+1 -1
View File
@@ -22,7 +22,7 @@ use std::{
fs::{remove_dir_all, File},
io::{Read, Write},
path::PathBuf,
process::{exit, Command, Stdio},
process::{Command, Stdio},
};
/// Build, bundle, & ship your Dioxus app.
+5 -8
View File
@@ -30,15 +30,14 @@ impl Tool {
if let Some(v) = tools::tools_path().to_str() {
println!("{}", v);
} else {
log::error!("Tools path get failed.");
return custom_error!("Tools path get failed.");
}
}
Tool::Add { name } => {
let tool_list = tools::tool_list();
if !tool_list.contains(&name.as_str()) {
log::error!("Tool {name} not found.");
return Ok(());
return custom_error!("Tool {name} not found.");
}
let target_tool = tools::Tool::from_str(&name).unwrap();
@@ -49,17 +48,15 @@ impl Tool {
log::info!("Start to download tool package...");
if let Err(e) = target_tool.download_package().await {
log::error!("Tool download failed: {e}");
return Ok(());
return custom_error!("Tool download failed: {e}");
}
log::info!("Start to install tool package...");
if let Err(e) = target_tool.install_package().await {
log::error!("Tool install failed: {e}");
return Ok(());
return custom_error!("Tool install failed: {e}");
}
log::info!("Tool {name} install successfully!");
log::info!("Tool {name} installed successfully!");
}
}
Ok(())
+3 -6
View File
@@ -27,14 +27,11 @@ impl Translate {
} = self;
let contents = match file {
Some(input) => std::fs::read_to_string(&input).unwrap_or_else(|e| {
log::error!("Cloud not read input file: {}.", e);
exit(0);
}),
Some(input) => std::fs::read_to_string(&input)
.map_err(|e| Error::CustomError(format!("Could not read input file: {e}.")))?,
None => {
if atty::is(atty::Stream::Stdin) {
log::error!("No input file, source, or stdin to translate from.");
exit(0);
return custom_error!("No input file, source, or stdin to translate from.");
}
let mut buffer = String::new();