mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-03-10 20:45:18 +08:00
Rename struct
This commit is contained in:
parent
743380290e
commit
92d5407269
@ -321,7 +321,7 @@ cli_print_target_available_sources (Source_t sources[], size_t size)
|
||||
}
|
||||
|
||||
void
|
||||
cli_print_target_features (FeatInfo f, const char *input_target_name)
|
||||
cli_print_target_features (Feature_t f, const char *input_target_name)
|
||||
{
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "\nAvailable Features:\n" : "\n可用功能:\n";
|
||||
@ -521,7 +521,7 @@ get_target (const char *input, TargetOp code, char *option)
|
||||
|
||||
if (!matched) return false;
|
||||
|
||||
TargetInfo *target = (TargetInfo*) *target_tmp;
|
||||
Target_t *target = (Target_t*) *target_tmp;
|
||||
|
||||
if (TargetOp_Set_Source==code)
|
||||
{
|
||||
@ -563,7 +563,7 @@ get_target (const char *input, TargetOp code, char *option)
|
||||
|
||||
if (target->featfn)
|
||||
{
|
||||
FeatInfo f = target->featfn("");
|
||||
Feature_t f = target->featfn("");
|
||||
cli_print_target_features (f, input);
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ Source_t;
|
||||
|
||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||
|
||||
|
||||
enum Capability_t
|
||||
{
|
||||
CanNot,
|
||||
@ -68,8 +69,8 @@ enum Capability_t
|
||||
};
|
||||
|
||||
|
||||
/* Target Feature Info */
|
||||
typedef struct FeatInfo_t
|
||||
/* Target Feature */
|
||||
typedef struct Feature_t
|
||||
{
|
||||
bool can_get;
|
||||
bool can_reset; /* 有的reset不是暂时没有实现,而是现在的实现根本就无法重置 */
|
||||
@ -83,22 +84,21 @@ typedef struct FeatInfo_t
|
||||
|
||||
char *note;
|
||||
}
|
||||
FeatInfo;
|
||||
Feature_t;
|
||||
|
||||
|
||||
/* Target Info */
|
||||
typedef struct TargetInfo_t
|
||||
typedef struct Target_t
|
||||
{
|
||||
void (*getfn) (char *option);
|
||||
void (*setfn) (char *option);
|
||||
void (*resetfn) (char *option);
|
||||
|
||||
FeatInfo (*featfn) (char *option);
|
||||
Feature_t (*featfn) (char *option);
|
||||
|
||||
Source_t *sources;
|
||||
size_t sources_n;
|
||||
}
|
||||
TargetInfo;
|
||||
Target_t;
|
||||
|
||||
|
||||
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
|
||||
@ -113,12 +113,12 @@ TargetInfo;
|
||||
#define def_target_sourcesn(t) t##_sources, t##_sources_n
|
||||
|
||||
// 大部分target还不支持reset,所以暂时先默认设置为NULL来过渡
|
||||
#define def_target(t) TargetInfo t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
||||
#define def_target_s(t) TargetInfo t##_target = {def_target_inner_s(t),def_target_sourcesn(t)}
|
||||
#define def_target_sr(t) TargetInfo t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)}
|
||||
#define def_target_sf(t) TargetInfo t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)}
|
||||
#define def_target_srf(t) TargetInfo t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)}
|
||||
#define def_target_gs(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(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
||||
#define def_target_s(t) Target_t t##_target = {def_target_inner_s(t),def_target_sourcesn(t)}
|
||||
#define def_target_sr(t) Target_t t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)}
|
||||
#define def_target_sf(t) Target_t t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)}
|
||||
#define def_target_srf(t) Target_t t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)}
|
||||
#define def_target_gs(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsr(t) Target_t t##_target = {def_target_inner_gsr(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsf(t) Target_t t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsrf(t) Target_t t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)}
|
||||
|
@ -97,10 +97,10 @@ pl_dart_flutter_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls flutter
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_dart_flutter_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -90,10 +90,10 @@ pl_dart_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_dart_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -90,10 +90,10 @@ pl_go_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls go
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_go_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -53,10 +53,10 @@ pl_julia_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_julia_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -62,10 +62,10 @@ pl_nodejs_bun_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls bun
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_bun_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -80,4 +80,4 @@ pl_nodejs_bun_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_nodejs_bun);
|
||||
TargetInfo pl_nodejs_bun_target = {def_target_inner_gsrf(pl_nodejs_bun),def_target_sourcesn(pl_nodejs)};
|
||||
Target_t pl_nodejs_bun_target = {def_target_inner_gsrf(pl_nodejs_bun),def_target_sourcesn(pl_nodejs)};
|
||||
|
@ -111,10 +111,10 @@ pl_nodejs_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls nodejs
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -89,10 +89,10 @@ pl_nodejs_yarn_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls yarn
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_yarn_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -107,4 +107,4 @@ pl_nodejs_yarn_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_nodejs_yarn);
|
||||
TargetInfo pl_nodejs_yarn_target = {def_target_inner_gsrf(pl_nodejs_yarn),def_target_sourcesn(pl_nodejs)};
|
||||
Target_t pl_nodejs_yarn_target = {def_target_inner_gsrf(pl_nodejs_yarn),def_target_sourcesn(pl_nodejs)};
|
||||
|
@ -58,10 +58,10 @@ pl_nodejs_npm_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls npm
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_npm_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -76,4 +76,4 @@ pl_nodejs_npm_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_nodejs_npm);
|
||||
TargetInfo pl_nodejs_npm_target = {def_target_inner_gsrf(pl_nodejs_npm),def_target_sourcesn(pl_nodejs)};
|
||||
Target_t pl_nodejs_npm_target = {def_target_inner_gsrf(pl_nodejs_npm),def_target_sourcesn(pl_nodejs)};
|
||||
|
@ -61,10 +61,10 @@ pl_nodejs_nvm_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls nvm
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_nvm_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
@ -79,4 +79,4 @@ pl_nodejs_nvm_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_nodejs_nvm);
|
||||
TargetInfo pl_nodejs_nvm_target = {def_target_inner_gsrf(pl_nodejs_nvm),def_target_sourcesn(pl_nodejs_binary_release)};
|
||||
Target_t pl_nodejs_nvm_target = {def_target_inner_gsrf(pl_nodejs_nvm),def_target_sourcesn(pl_nodejs_binary_release)};
|
||||
|
@ -59,10 +59,10 @@ pl_nodejs_pnpm_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls pnpm
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_nodejs_pnpm_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -78,4 +78,4 @@ pl_nodejs_pnpm_feat (char *option)
|
||||
|
||||
|
||||
// def_target_gsrf(pl_nodejs_pnpm);
|
||||
TargetInfo pl_nodejs_pnpm_target = {def_target_inner_gsrf(pl_nodejs_pnpm),def_target_sourcesn(pl_nodejs)};
|
||||
Target_t pl_nodejs_pnpm_target = {def_target_inner_gsrf(pl_nodejs_pnpm),def_target_sourcesn(pl_nodejs)};
|
||||
|
@ -61,10 +61,10 @@ pl_php_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_php_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -60,10 +60,10 @@ pl_python_pdm_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls pdm
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_python_pdm_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -80,4 +80,4 @@ pl_python_pdm_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_python_pdm);
|
||||
TargetInfo pl_python_pdm_target = {def_target_inner_gsrf(pl_python_pdm),def_target_sourcesn(pl_python)};
|
||||
Target_t pl_python_pdm_target = {def_target_inner_gsrf(pl_python_pdm),def_target_sourcesn(pl_python)};
|
||||
|
@ -58,10 +58,10 @@ pl_python_poetry_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls poetry
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_python_poetry_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -76,4 +76,4 @@ pl_python_poetry_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_python_poetry);
|
||||
TargetInfo pl_python_poetry_target = {def_target_inner_gsrf(pl_python_poetry),def_target_sourcesn(pl_python)};
|
||||
Target_t pl_python_poetry_target = {def_target_inner_gsrf(pl_python_poetry),def_target_sourcesn(pl_python)};
|
||||
|
@ -81,10 +81,10 @@ pl_python_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_python_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -70,10 +70,10 @@ pl_python_pip_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls pip
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_python_pip_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
@ -89,4 +89,4 @@ pl_python_pip_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_python_pip);
|
||||
TargetInfo pl_python_pip_target = {def_target_inner_gsrf(pl_python_pip),def_target_sourcesn(pl_python)};
|
||||
Target_t pl_python_pip_target = {def_target_inner_gsrf(pl_python_pip),def_target_sourcesn(pl_python)};
|
||||
|
@ -97,10 +97,10 @@ pl_ruby_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_ruby_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -70,10 +70,10 @@ pl_rust_cargo_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_rust_cargo_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -98,10 +98,10 @@ pl_rust_rustup_resetsrc (char *option)
|
||||
/**
|
||||
* chsrc ls rustup
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
pl_rust_rustup_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -61,10 +61,10 @@ os_armbian_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_armbian_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -109,10 +109,10 @@ os_debian_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_debian_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -129,10 +129,10 @@ os_ubuntu_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_ubuntu_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
@ -85,10 +85,10 @@ os_fedora_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_fedora_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = false;
|
||||
f.can_reset = true;
|
||||
|
@ -129,10 +129,10 @@ os_archlinuxcn_setsrc (char *option)
|
||||
#undef OS_Pacman_MirrorList
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_arch_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
@ -146,10 +146,10 @@ os_arch_feat (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
os_archlinuxcn_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -23,4 +23,4 @@ os_manjaro_setsrc (char *option)
|
||||
chsrc_conclude (NULL, SetsrcType_Auto);
|
||||
}
|
||||
|
||||
TargetInfo os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0};
|
||||
Target_t os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0};
|
||||
|
@ -105,10 +105,10 @@ void
|
||||
*
|
||||
* 用于 chsrc ls <target>
|
||||
*/
|
||||
FeatInfo
|
||||
Feature_t
|
||||
<category>_<target>_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -155,10 +155,10 @@ wr_dockerhub_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
wr_dockerhub_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -86,10 +86,10 @@ wr_homebrew_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
wr_homebrew_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = false;
|
||||
|
@ -45,10 +45,10 @@ wr_winget_resetsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
FeatInfo
|
||||
Feature_t
|
||||
wr_winget_feat (char *option)
|
||||
{
|
||||
FeatInfo f = {0};
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user