From 56559b57b265271d11e9885272cb4896683d8d45 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sat, 17 Aug 2024 05:30:28 +0800 Subject: [PATCH] Update reset and local feat --- include/source.h | 3 ++- src/recipe/lang/nodejs.c | 19 +++++++++++++++++-- src/recipe/lang/php.c | 20 ++++++++++++++++++-- src/recipe/lang/python.c | 32 +++++++++++++++++++++----------- src/recipe/ware/WinGet.c | 19 +++++++++++++++++-- 5 files changed, 75 insertions(+), 18 deletions(-) diff --git a/include/source.h b/include/source.h index 3e61bfd..6db51c3 100644 --- a/include/source.h +++ b/include/source.h @@ -7,7 +7,7 @@ * Contributors : Shengwei Chen <414685209@qq.com> * | * Created on : <2023-08-29> - * Last modified : <2024-08-16> + * Last modified : <2024-08-17> * * 镜像站与换源信息 * ------------------------------------------------------------*/ @@ -160,5 +160,6 @@ typedef struct TargetInfo_t { // 大部分target还不支持reset,所以暂时先默认设置为NULL来过渡 #define def_target(t) TargetInfo t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)} #define def_target_gsr(t) TargetInfo t##_target = {def_target_inner_gsr(t),def_target_sourcesn(t)} +#define def_target_gsf(t) TargetInfo t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)} #define def_target_gsrf(t) TargetInfo t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)} #define def_target_s(t) TargetInfo t##_target = {def_target_inner_s(t),def_target_sourcesn(t)} diff --git a/src/recipe/lang/nodejs.c b/src/recipe/lang/nodejs.c index f3228b2..8dbb8da 100644 --- a/src/recipe/lang/nodejs.c +++ b/src/recipe/lang/nodejs.c @@ -4,7 +4,7 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2023-08-30> - * Last Modified : <2024-08-09> + * Last Modified : <2024-08-17> * ------------------------------------------------------------*/ static MirrorSite @@ -114,4 +114,19 @@ pl_nodejs_setsrc (char *option) } -def_target(pl_nodejs); +FeatInfo +pl_nodejs_feat (char *option) +{ + FeatInfo fi = {0}; + + fi.can_get = true; + fi.can_reset = false; + + fi.locally = "npm 支持 (From v0.1.7); yarn 未知; pnpm 未知;"; + fi.can_english = false; + fi.can_user_define = true; + + return fi; +} + +def_target_gsf (pl_nodejs); diff --git a/src/recipe/lang/php.c b/src/recipe/lang/php.c index c06dc40..4270be4 100644 --- a/src/recipe/lang/php.c +++ b/src/recipe/lang/php.c @@ -4,7 +4,7 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2023-08-30> - * Last Modified : <2024-08-09> + * Last Modified : <2024-08-17> * ------------------------------------------------------------*/ /** @@ -61,4 +61,20 @@ pl_php_setsrc (char *option) chsrc_say_lastly (&source, ChsrcTypeSemiAuto); } -def_target(pl_php); + +FeatInfo +pl_php_feat (char *option) +{ + FeatInfo fi = {0}; + + fi.can_get = true; + fi.can_reset = false; + + fi.locally = "composer 支持 (From v0.1.7)"; + fi.can_english = false; + fi.can_user_define = true; + + return fi; +} + +def_target_gsf (pl_php); diff --git a/src/recipe/lang/python.c b/src/recipe/lang/python.c index 70ebe76..bba2f3a 100644 --- a/src/recipe/lang/python.c +++ b/src/recipe/lang/python.c @@ -4,10 +4,9 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2023-09-03> - * Last Modified : <2024-08-09> + * Last Modified : <2024-08-17> * ------------------------------------------------------------*/ - /** * 2024-05-24 更新 * @@ -47,18 +46,13 @@ pl_python_check_cmd (char **prog, bool *poetry_exist, bool *pdm_exist) // 因此我们首先测试 python3 py_exist = chsrc_check_program ("python3"); - if (py_exist) - { - *prog = "python3"; - } + if (py_exist) *prog = "python3"; else { // 不要调用 python 自己,而是使用 python --version,避免Windows弹出Microsoft Store py_exist = chsrc_check_program ("python"); - if (py_exist) - { - *prog = "python"; - } + + if (py_exist) *prog = "python"; else { chsrc_error ("未找到 Python 相关命令,请检查是否存在"); @@ -149,4 +143,20 @@ pl_python_resetsrc (char *option) pl_python_setsrc (ChsrcTypeReset); } -def_target_gsr(pl_python); + +FeatInfo +pl_python_feat (char *option) +{ + FeatInfo fi = {0}; + + fi.can_get = true; + fi.can_reset = true; + + fi.locally = "pip 不支持; pdm 支持 (From v0.1.6); poetry 默认使用项目级 (From v0.1.7.2)"; + fi.can_english = false; + fi.can_user_define = true; + + return fi; +} + +def_target_gsrf(pl_python); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 2be41a8..daa783b 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -4,7 +4,7 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2024-06-07> - * Last Modified : <2024-08-15> + * Last Modified : <2024-08-17> * ------------------------------------------------------------*/ /** @@ -46,4 +46,19 @@ wr_winget_resetsrc (char *option) chsrc_say_lastly (NULL, ChsrcTypeAuto); } -def_target_gsr(wr_winget); + +FeatInfo +wr_winget_feat (char *option) +{ + FeatInfo fi = {0}; + + fi.can_get = true; + fi.can_reset = true; + + fi.can_english = false; + fi.can_user_define = true; + + return fi; +} + +def_target_gsrf(wr_winget);