From cfa68efac5205fe79e08376b8ecf24b4064896df Mon Sep 17 00:00:00 2001 From: limuy <limuyang202011@163.com> Date: Sun, 31 Mar 2024 11:42:32 +0800 Subject: [PATCH] feat(trc):remove update subcommand --- src/compiler/ast.rs | 1 - src/lib.rs | 7 +------ src/tools.rs | 1 - src/tools/update.rs | 40 ---------------------------------------- 4 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 src/tools/update.rs diff --git a/src/compiler/ast.rs b/src/compiler/ast.rs index ae31dfa5..86630370 100644 --- a/src/compiler/ast.rs +++ b/src/compiler/ast.rs @@ -914,7 +914,6 @@ impl<'a> AstBuilder<'a> { now_module_path = now_module_path.join(path.clone()); if now_module_path.exists() { // 创建新的compiler来编译模块 - // let mut new_compiler = Compiler::new(Option::new()); } else { return self.try_err( istry, diff --git a/src/lib.rs b/src/lib.rs index 55d9c73b..c67cf6e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ macro_rules! make_commands { make_commands!(Commands, Build {}, Run {}, Dis { #[arg(short, long, default_value_t = false)] rustcode: bool -}, | Tshell {}, Update{}, Version {}); +}, | Tshell {}, Version {}); shadow_rs::shadow!(build); @@ -67,11 +67,6 @@ pub fn run() -> Result<(), Box<dyn Error>> { Commands::Tshell {} => { tools::tshell::tshell()?; } - Commands::Update {} => { - if let Err(e) = tools::update::update() { - println!("{}", e); - } - } Commands::Run { optimize, files } => { for i in files { match tools::run::run(compiler::CompileOption::new( diff --git a/src/tools.rs b/src/tools.rs index 0aea743a..4f4802d4 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -2,6 +2,5 @@ pub mod compile_tool; pub mod dis; pub mod run; pub mod tshell; -pub mod update; pub use compile_tool::compile; diff --git a/src/tools/update.rs b/src/tools/update.rs deleted file mode 100644 index 43cfbed8..00000000 --- a/src/tools/update.rs +++ /dev/null @@ -1,40 +0,0 @@ -use std::{error::Error, fmt::Display}; - -static _GITHUB_API_URL: &str = "http://185.106.176.199/trc_version"; - -pub fn check_version() -> Result<(), Box<dyn Error>> { - Ok(()) -} - -#[derive(Debug)] -pub struct UpdateError {} - -impl Error for UpdateError {} - -impl Display for UpdateError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "Only support Linux.Users on other platforms should update program by hand" - ) - } -} - -impl Default for UpdateError { - fn default() -> Self { - Self::new() - } -} - -impl UpdateError { - pub fn new() -> Self { - Self {} - } -} - -pub fn update() -> Result<(), UpdateError> { - if !cfg!(target_os = "linux") { - return Err(UpdateError::new()); - } - Ok(()) -}