diff --git a/src/framework/chef.c b/src/framework/chef.c index 9a60381..caad435 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -74,7 +74,7 @@ chef_forbid_user_define (Target_t *target) void chef_set_note (Target_t *target, const char *note_zh, const char *note_en) { - if (!target || !note) + if (!target) return; char *msg = CHINESE ? xy_strdup(note_zh) : xy_strdup(note_en); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index c2ea6e1..9b69081 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -25,11 +25,10 @@ wr_anaconda_prelude () chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = false; - this.note = "无法自定义源, 因为这些链接将会在setsrc函数中补充完整"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); def_upstream("https://repo.anaconda.com"); def_sources_begin() diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 20a9435..9ca34fd 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -22,11 +22,10 @@ wr_cocoapods_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_allow_user_define(this); def_upstream("https://github.com/CocoaPods/Specs.git"); def_sources_begin() diff --git a/src/recipe/ware/Docker-Hub/Docker-Hub.c b/src/recipe/ware/Docker-Hub/Docker-Hub.c index b0e25d5..bdf3fa5 100644 --- a/src/recipe/ware/Docker-Hub/Docker-Hub.c +++ b/src/recipe/ware/Docker-Hub/Docker-Hub.c @@ -41,11 +41,10 @@ wr_dockerhub_prelude () chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_allow_user_define(this); def_upstream("https://hub.docker.com/"); def_sources_begin() diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index 2d7bb79..2db949c 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -29,11 +29,13 @@ wr_emacs_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = false; - this.note = "Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note (this, "Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档", + "Emacs users typically only need to switch sources once and rarely call chsrc, so we only provide documentation to users"); def_upstream("https://elpa.gnu.org/"); def_sources_begin() diff --git a/src/recipe/ware/Flathub.c b/src/recipe/ware/Flathub.c index a3caed9..defde2c 100644 --- a/src/recipe/ware/Flathub.c +++ b/src/recipe/ware/Flathub.c @@ -22,11 +22,13 @@ wr_flathub_prelude () chef_allow_get(); chef_allow_set(); chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_allow_user_define(this); + + chef_set_note (this, "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue", + "The test file for Flathub is very small, causing inaccurate speed test results. If you know a URL suitable for speed testing, welcome to contribute: chsrc issue"); def_upstream("https://flathub.org/repo"); def_sources_begin() diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index 1457a0a..521742e 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -22,11 +22,13 @@ wr_guix_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = false; - this.note = "目前只有一个源, guixcn 的源不知道是否可用"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note (this, "目前只有一个源, guixcn 的源不知道是否可用", + "Currently only one source available, guixcn source availability unknown"); def_upstream("https://git.savannah.gnu.org/git/guix.git"); def_sources_begin() diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index c1d5801..7273bda 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -24,11 +24,13 @@ wr_homebrew_prelude () chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = true; - this.can_user_define = false; - this.note = "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_allow_english(this); + chef_forbid_user_define(this); + + chef_set_note (this, "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件", + "This source switching is implemented by writing environment variables. If switching sources multiple times, please manually clean the profile file"); def_upstream("https://github.com/Homebrew/brew.git"); def_sources_begin() diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index a462e37..27c9ccc 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -22,11 +22,10 @@ wr_nix_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = false; - this.note = "不可自动换源,因为链接将会在setsrc函数中补充完整"; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); def_upstream("https://channels.nixos.org/"); def_sources_begin() diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 6b74beb..249e24a 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -24,11 +24,10 @@ wr_tex_prelude () chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_allow_user_define(this); def_upstream("https://ctan.org/tex-archive/systems/texlive/tlnet"); def_sources_begin() diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 2d21dc1..b69637b 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -21,8 +21,9 @@ wr_winget_prelude () chef_allow_get(); chef_allow_set(); chef_allow_reset(); - this.can_english = false; - this.can_user_define = true; + + chef_forbid_english(this); + chef_allow_user_define(this); def_upstream("https://github.com/microsoft/winget-cli/"); def_sources_begin()