From 5b23eb08e6b8b645d482a78b7dc9749876dff79d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 31 Oct 2024 20:49:33 +0800 Subject: [PATCH] Implement `reset` for `Go`, `Pub`, `Flutter` [GitHub #111] --- src/chsrc-main.c | 2 +- src/recipe/lang/Dart/Flutter.c | 11 +++++++++-- src/recipe/lang/Dart/Pub.c | 11 +++++++++-- src/recipe/lang/Go.c | 31 ++++++++++++++++++++++++++++++- src/recipe/lang/Ruby.c | 2 +- 5 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index a17d89f..89033d1 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -24,7 +24,7 @@ * chsrc: Change Source —— 全平台通用命令行换源工具 * ------------------------------------------------------------*/ -#define Chsrc_Version "0.1.9.2" +#define Chsrc_Version "0.1.9.2-dev1" #define Chsrc_Release_Date "2024/10/31" #define Chsrc_Banner_Version "v" Chsrc_Version "-" Chsrc_Release_Date #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index bfdc63f..7f8387c 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -87,6 +87,13 @@ pl_dart_flutter_setsrc (char *option) } +void +pl_dart_flutter_resetsrc (char *option) +{ + pl_dart_flutter_setsrc (SetsrcType_Reset); +} + + /** * chsrc ls flutter */ @@ -96,7 +103,7 @@ pl_dart_flutter_feat (char *option) FeatInfo f = {0}; f.can_get = true; - f.can_reset = false; + f.can_reset = true; f.cap_locally = CanNot; f.locally = NULL; @@ -108,4 +115,4 @@ pl_dart_flutter_feat (char *option) return f; } -def_target_gsf(pl_dart_flutter); +def_target_gsrf(pl_dart_flutter); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 16e3041..3dfad38 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -83,13 +83,20 @@ pl_dart_setsrc (char *option) } +void +pl_dart_resetsrc (char *option) +{ + pl_dart_setsrc (SetsrcType_Reset); +} + + FeatInfo pl_dart_feat (char *option) { FeatInfo f = {0}; f.can_get = true; - f.can_reset = false; + f.can_reset = true; f.cap_locally = CanNot; f.locally = NULL; @@ -101,4 +108,4 @@ pl_dart_feat (char *option) return f; } -def_target_gsf(pl_dart); +def_target_gsrf(pl_dart); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index a2537a9..6b2c247 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -75,4 +75,33 @@ pl_go_setsrc (char *option) chsrc_conclude (&source, SetsrcType_Auto); } -def_target(pl_go); + +void +pl_go_resetsrc (char *option) +{ + pl_go_setsrc (SetsrcType_Reset); +} + + +/** + * chsrc ls go + */ +FeatInfo +pl_go_feat (char *option) +{ + FeatInfo f = {0}; + + f.can_get = true; + f.can_reset = true; + + f.cap_locally = CanNot; + f.locally = NULL; + f.can_english = false; + + f.can_user_define = true; + + f.note = NULL; + return f; +} + +def_target_gsrf(pl_go); diff --git a/src/recipe/lang/Ruby.c b/src/recipe/lang/Ruby.c index ab7edbb..1542607 100644 --- a/src/recipe/lang/Ruby.c +++ b/src/recipe/lang/Ruby.c @@ -55,7 +55,7 @@ pl_ruby_remove_gem_source (const char *source) } /** - * Ruby换源,参考:https://gitee.com/RubyMetric/rbenv-cn + * @consult https://gitee.com/RubyMetric/rbenv-cn */ void pl_ruby_setsrc (char *option)