mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-14 00:20:47 +08:00
Simplify chef api
This commit is contained in:
parent
23ba6b8419
commit
1f1008c440
@ -46,6 +46,11 @@ chef_ensure_trailing_slash (char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define chef_has_getfn() this->getfn = t##_getsrc;
|
||||||
|
#define chef_has_setfn() this->setfn = t##_setsrc;
|
||||||
|
#define chef_has_resetsrc() this->resetfn = t##_resetsrc;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_contributors (Target_t *target, uint32_t count, ...)
|
chef_set_contributors (Target_t *target, uint32_t count, ...)
|
||||||
{
|
{
|
||||||
@ -70,7 +75,7 @@ chef_set_contributors (Target_t *target, uint32_t count, ...)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_recipe_authors (Target_t *target, size_t count, ...)
|
chef_set_authors (Target_t *target, size_t count, ...)
|
||||||
{
|
{
|
||||||
if (!target || count == 0)
|
if (!target || count == 0)
|
||||||
return;
|
return;
|
||||||
@ -95,7 +100,7 @@ chef_set_recipe_authors (Target_t *target, size_t count, ...)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_current_chef (Target_t *target, char *name, char *email)
|
chef_set_chef (Target_t *target, char *name, char *email)
|
||||||
{
|
{
|
||||||
if (!target || !name || !email)
|
if (!target || !name || !email)
|
||||||
return;
|
return;
|
||||||
@ -107,7 +112,7 @@ chef_set_current_chef (Target_t *target, char *name, char *email)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_current_sous_chefs (Target_t *target, size_t count, ...)
|
chef_set_sous_chefs (Target_t *target, size_t count, ...)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
@ -139,7 +144,7 @@ chef_set_current_sous_chefs (Target_t *target, size_t count, ...)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_recipe_created_on_date (Target_t *target, char *date)
|
chef_set_created_on (Target_t *target, char *date)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
@ -149,7 +154,7 @@ chef_set_recipe_created_on_date (Target_t *target, char *date)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_recipe_last_updated_date (Target_t *target, char *date)
|
chef_set_last_updated (Target_t *target, char *date)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
@ -159,7 +164,7 @@ chef_set_recipe_last_updated_date (Target_t *target, char *date)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_set_sources_last_updated_date (Target_t *target, char *date)
|
chef_set_sources_last_updated (Target_t *target, char *date)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
@ -9,18 +9,29 @@ wr_flathub_prelude ()
|
|||||||
{
|
{
|
||||||
use_this(wr_flathub);
|
use_this(wr_flathub);
|
||||||
|
|
||||||
chef_set_recipe_created_on_date (this, "2023-09-11");
|
chef_set_created_on (this, "2023-09-11");
|
||||||
chef_set_recipe_last_updated_date (this, "2025-08-09");
|
chef_set_last_updated (this, "2025-08-09");
|
||||||
|
|
||||||
|
|
||||||
chef_set_recipe_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
|
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
|
||||||
chef_set_current_chef (this, NULL, NULL);
|
chef_set_chef (this, NULL, NULL);
|
||||||
chef_set_current_sous_chefs (this, 0);
|
chef_set_sous_chefs (this, 0);
|
||||||
chef_set_contributors (this, 1,
|
chef_set_contributors (this, 1,
|
||||||
"Jialin Lyu", "jialinlvcn@aliyun.com");
|
"Jialin Lyu", "jialinlvcn@aliyun.com");
|
||||||
|
|
||||||
|
|
||||||
chef_set_sources_last_updated_date (this, "2025-05-27");
|
chef_has_getfn();
|
||||||
|
chef_has_setfn();
|
||||||
|
chef_has_resetsrc();
|
||||||
|
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_set_sources_last_updated (this, "2025-05-27");
|
||||||
def_upstream_provider("https://flathub.org/repo");
|
def_upstream_provider("https://flathub.org/repo");
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
@ -48,9 +59,6 @@ wr_flathub_prelude ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* chsrc get flathub
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
wr_flathub_getsrc (char *option)
|
wr_flathub_getsrc (char *option)
|
||||||
{
|
{
|
||||||
@ -88,35 +96,8 @@ wr_flathub_setsrc (char *option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* chsrc reset flathub
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
wr_flathub_resetsrc (char *option)
|
wr_flathub_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
wr_flathub_setsrc (option);
|
wr_flathub_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* chsrc ls flathub
|
|
||||||
*/
|
|
||||||
Feature_t
|
|
||||||
wr_flathub_feat (char *option)
|
|
||||||
{
|
|
||||||
Feature_t f = {0};
|
|
||||||
|
|
||||||
f.can_get = true;
|
|
||||||
f.can_reset = true;
|
|
||||||
|
|
||||||
f.cap_locally = CanNot;
|
|
||||||
f.cap_locally_explain = NULL;
|
|
||||||
f.can_english = false;
|
|
||||||
f.can_user_define = true;
|
|
||||||
|
|
||||||
f.note = "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue";
|
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// def_target_gsrf (wr_flathub);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user