From bf400be959ec9a7a7fc48fadf8437bb29fb147d3 Mon Sep 17 00:00:00 2001 From: ARCJ137442 <61109168+ARCJ137442@users.noreply.github.com> Date: Sat, 14 Sep 2024 16:10:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:green=5Fheart:=20=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8DCI=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📝`if cfg!(windows)`对`#[cfg(windows)]`无效:编译时仍会缺少符号 --- README.en-us.md => README.en.md | 9 ++++++--- README.md | 7 +++++-- src/cli/mod.rs | 20 +++++++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) rename README.en-us.md => README.en.md (71%) diff --git a/README.en-us.md b/README.en.md similarity index 71% rename from README.en-us.md rename to README.en.md index d95f5b0..3ee4783 100644 --- a/README.en-us.md +++ b/README.en.md @@ -1,11 +1,14 @@ -# BabelNAR.rs +# BabelNAR-CLI.rs -[简体中文](./README.md) | English +|[简体中文](README.md) | **English**| +|:-:|:-:| 🏗️The **English document** of the project is still under preparation. PR is welcome. [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) -Implementation and application supports of the NAVM model +## Introduction + +[**BabelNAR.rs**](https://github.com/ARCJ137442/BabelNAR.rs)'s Command Line Interface (CLI) ⚠️【2024-04-03 15:12:55】**This documentation is still in progress. For full and latest content, please refer to [the Simplified Chinese version](README.zh-cn.md).** diff --git a/README.md b/README.md index a9da656..8e01e2a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # BabelNAR-CLI.rs -简体中文 | [English](./README.en-us.md) +|**简体中文** | [English](README.en.md)| +|:-:|:-:| 🏗️项目的**英文文档**尚在筹建,有意者欢迎提交PR @@ -8,7 +9,9 @@ 该项目使用[语义化版本 2.0.0](https://semver.org/)进行版本号管理。 -[**BabelNAR.rs**](https://github.com/ARCJ137442/NAVM.rs)的命令行接口(CLI) +## 简介 + +[**BabelNAR.rs**](https://github.com/ARCJ137442/BabelNAR.rs)的命令行接口(CLI) - ✨从配置中快速启动、测试各类NARS实现 - 🎯一站式NARS**启动器** diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 61b3b5e..0ee5884 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -39,11 +39,8 @@ pub fn main_args(cwd: IoResult, args: impl Iterator) -> .inspect_err(|e| println_cli!([Warn] "无法获取当前工作目录:{e}")) .ok(); - // (Windows下)启用终端颜色 - if cfg!(windows) { - let _ = colored::control::set_virtual_terminal(true) - .inspect_err(|_| eprintln_cli!([Error] "无法启动终端彩色显示。。")); - } + // 启用终端颜色(若可) + set_virtual_terminal(); // 解析命令行参数 let args = CliArgs::parse_from(args); @@ -93,3 +90,16 @@ pub fn main_args(cwd: IoResult, args: impl Iterator) -> // 返回结果 result } + +/// 启动终端颜色(Windows下) +#[cfg(windows)] +fn set_virtual_terminal() { + let _ = colored::control::set_virtual_terminal(true) + .inspect_err(|_| eprintln_cli!([Error] "无法启动终端彩色显示。。")); +} + +/// 启动终端颜色(非Windows) +#[cfg(not(windows))] +fn set_virtual_terminal() { + // * 🚩【2024-09-14 16:09:42】目前代码为空 +}