DSL for user define capability

This commit is contained in:
Aoran Zeng 2025-08-10 10:08:26 +08:00
parent 8458a193a6
commit d6fbaf91ce
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 33 additions and 6 deletions

View File

@ -51,6 +51,29 @@ chef_ensure_trailing_slash (char *str)
#define chef_has_reset() this->resetfn = t##_resetsrc;
void
chef_allow_user_define (Target_t *target)
{
if (!target)
return;
target->can_user_define = true;
target->can_user_define_explain = NULL;
}
void
chef_forbid_user_define (Target_t *target)
{
if (!target)
return;
target->can_user_define = false;
char *reason = CHINESE ? "URL将会根据内部实现重写,因此不能自定义" : "The URL will be rewritten based on internal implementation, so it cannot be customized";
target->can_user_define_explain = reason;
}
void
chef_set_contributors (Target_t *target, uint32_t count, ...)
{

View File

@ -52,7 +52,7 @@ void
{
use_this(<category>_<target>);
chef_set_created_on (this, "2025-08-09");
chef_set_created_on (this, "2024-08-09");
chef_set_last_updated (this, "2025-08-12");
chef_set_sources_last_updated (this, "2025-08-10");
@ -62,13 +62,17 @@ void
chef_set_contributors (this, 1,
"Nil Null", "nil@null.org");
chef_has_getfn();
chef_has_setfn();
chef_has_resetsrc();
this.cap_locally = PartiallyCan;
this.cap_locally_explain = "具体说明是否支持项目级换源...";
chef_has_get();
chef_has_set();
chef_has_reset();
this.cap_local = PartiallyCan;
this.cap_local_explain = "具体说明是否支持项目级换源...";
this.can_english = false;
this.can_user_define = false;
// chef_allow_user_define(this);
chef_forbid_user_define(this);
this.note = "备注说明...";
def_upstream("https://github.com/microsoft/winget-cli/");