Split winget out

This commit is contained in:
Aoran Zeng 2024-08-16 04:11:38 +08:00
parent 66b2d36c39
commit bbfb6d5401
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 51 additions and 45 deletions

View File

@ -153,21 +153,10 @@ pl_dotnet_sources[] = {
/**
* @time 2024-06-07
* @note
*/
static SourceInfo
wr_winget_sources[] = {
{&Upstream, "https://cdn.winget.microsoft.com/cache"},
{&Ustc, "https://mirrors.ustc.edu.cn/winget-source"},
},
/**
* @time 2024-06-08
*/
static SourceInfo
wr_cocoapods_sources[] = {
{&Upstream, NULL},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git"},
@ -248,8 +237,6 @@ wr_tex_sources[] = {
def_sources_n(pl_clojure);
def_sources_n(pl_dotnet);
def_sources_n(wr_winget);
def_sources_n(wr_cocoapods);
def_sources_n(wr_flathub);

View File

@ -177,36 +177,7 @@ wr_tex_setsrc (char *option)
#include "recipe/ware/emacs.c"
void
wr_winget_getsrc (char *option)
{
chsrc_run ("winget source list", RunOpt_Default);
}
/* 参考https://mirrors.ustc.edu.cn/help/winget-source.html */
void
wr_winget_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_winget);
chsrc_confirm_source (&source);
chsrc_run ("winget source remove winget", RunOpt_Default);
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeAuto);
}
void
wr_winget_resetsrc (char *option)
{
chsrc_run ("winget source reset winget", RunOpt_Default);
chsrc_say_lastly (NULL, ChsrcTypeAuto);
}
#include "recipe/ware/WinGet.c"
#include "recipe/ware/Homebrew.c"
/**

View File

@ -92,7 +92,6 @@ static const char
};
def_target_full(wr_winget);
def_target_noget (wr_cocoapods);
def_target_noget (wr_flathub);
def_target_noget (wr_nix);

49
src/recipe/ware/WinGet.c Normal file
View File

@ -0,0 +1,49 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2024-06-07>
* Last Modified : <2024-08-15>
* ------------------------------------------------------------*/
/**
* @time 2024-06-07
* @note
*/
static SourceInfo
wr_winget_sources[] = {
{&Upstream, "https://cdn.winget.microsoft.com/cache"},
{&Ustc, "https://mirrors.ustc.edu.cn/winget-source"},
};
def_sources_n(wr_winget);
void
wr_winget_getsrc (char *option)
{
chsrc_run ("winget source list", RunOpt_Default);
}
/* 参考https://mirrors.ustc.edu.cn/help/winget-source.html */
void
wr_winget_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_winget);
chsrc_confirm_source (&source);
chsrc_run ("winget source remove winget", RunOpt_Default);
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeAuto);
}
void
wr_winget_resetsrc (char *option)
{
chsrc_run ("winget source reset winget", RunOpt_Default);
chsrc_say_lastly (NULL, ChsrcTypeAuto);
}
def_target_full(wr_winget);