Support winget

[Gitee link #I9W0SE]
This commit is contained in:
Aoran Zeng 2024-06-07 21:17:29 +08:00
parent 5fd8e86fb9
commit e4c71aa56d

View File

@ -1772,6 +1772,26 @@ wr_emacs_setsrc(char *option)
}
void
wr_winget_getsrc (char *option)
{
chsrc_run ("winget source list");
}
void
wr_winget_setsrc (char *option)
{
int index = use_specific_mirror_or_auto_select (option, wr_winget);
SourceInfo source = wr_winget_sources[index];
chsrc_say_selection (&source);
chsrc_run ("winget source remove winget");
chsrc_run (xy_2strjoin ("winget source add winget ", source.url));
chsrc_say_thanks (&source);
}
void
wr_brew_getsrc (char *option)
@ -2062,7 +2082,7 @@ static const char
};
def_target(wr_brew); def_target(wr_tex);
def_target(wr_winget); def_target(wr_brew); def_target(wr_tex);
TargetInfo
wr_flathub_target = {wr_flathub_setsrc, NULL, wr_flathub_sources, wr_flathub_sources_n},
wr_nix_target = {wr_nix_setsrc, NULL, wr_nix_sources, wr_nix_sources_n},
@ -2071,6 +2091,7 @@ TargetInfo
wr_anaconda_target = {wr_anaconda_setsrc, NULL, wr_anaconda_sources, wr_anaconda_sources_n};
static const char
*wr_winget [] = {"winget", NULL, t(&wr_winget_target)},
*wr_brew [] = {"brew", "homebrew", NULL, t(&wr_brew_target)},
*wr_flathub [] = {"flathub", NULL, t(&wr_flathub_target)},
*wr_nix [] = {"nix", NULL, t(&wr_nix_target)},
@ -2080,7 +2101,7 @@ static const char
*wr_anaconda[] = {"conda", "anaconda", NULL, t(&wr_anaconda_target)},
**wr_softwares[] =
{
wr_brew, wr_flathub, wr_nix, wr_guix, wr_emacs, wr_tex, wr_anaconda
wr_winget, wr_brew, wr_flathub, wr_nix, wr_guix, wr_emacs, wr_tex, wr_anaconda
};
#undef t
/************************************** End Target Matrix ****************************************/