mirror of
https://gitee.com/RubyMetric/chsrc.git
synced 2025-12-29 14:32:45 +00:00
Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fd79ea284 | ||
|
|
6418b1557f | ||
|
|
a41ff32936 | ||
|
|
79b9f8dbfd | ||
|
|
98cc5876fc | ||
|
|
4f040cf115 | ||
|
|
64c4ec3c5f | ||
|
|
84503248d5 | ||
|
|
1f2bf0bf3d | ||
|
|
52f2ea5003 | ||
|
|
f7393fafbf | ||
|
|
ecf686576b | ||
|
|
8d768309d9 | ||
|
|
e3112f8dba | ||
|
|
08b213ae0b | ||
|
|
3816263878 | ||
|
|
3657c9f7dd | ||
|
|
f5c78c5a04 | ||
|
|
db9449993b | ||
|
|
6613c676cc | ||
|
|
b8ff421a8a | ||
|
|
7e6c90319d | ||
|
|
9a6f39216c | ||
|
|
55aef454e9 | ||
|
|
64581bb718 | ||
|
|
46e2cb8d43 | ||
|
|
c22fae679e | ||
|
|
6a527dba00 | ||
|
|
dafbb302bb | ||
|
|
6e03939f45 | ||
|
|
1264b4192f | ||
|
|
332186224f | ||
|
|
fed349827c | ||
|
|
fd309e7300 | ||
|
|
4a13358c8b | ||
|
|
8833eb99c1 | ||
|
|
6af042ca9f | ||
|
|
0c3405803a | ||
|
|
cbf22a7f29 | ||
|
|
37710884a8 | ||
|
|
066ac191a6 | ||
|
|
985a6344b3 | ||
|
|
8e392b04b8 | ||
|
|
6060b325be | ||
|
|
d84bdba08a | ||
|
|
c6897bd73e | ||
|
|
1058d3310b | ||
|
|
28d8e4ad0c | ||
|
|
8ebe5812ed | ||
|
|
19d09e537a | ||
|
|
ebc9e167f2 | ||
|
|
e030c8095e | ||
|
|
f926834384 | ||
|
|
6af3e51566 | ||
|
|
990b8d0df3 | ||
|
|
1ac8b892e2 | ||
|
|
c44377f2d9 | ||
|
|
16602d0e7f | ||
|
|
6f312a66c0 | ||
|
|
948d55185f | ||
|
|
41783b8531 | ||
|
|
5588beb542 | ||
|
|
547931c4e4 | ||
|
|
e64778911a | ||
|
|
2a9d13bfc8 | ||
|
|
a3600bf05f | ||
|
|
437729a5cf | ||
|
|
b2a844b676 | ||
|
|
5771a308a6 | ||
|
|
0b4215f257 | ||
|
|
cfe850382d | ||
|
|
717b0f96b8 | ||
|
|
91692d6215 | ||
|
|
6aac016c02 | ||
|
|
1829f6e622 | ||
|
|
b84f2f9edd | ||
|
|
de75aaa62b | ||
|
|
a5e358fc4a | ||
|
|
9666b769a1 | ||
|
|
730d18a8a9 | ||
|
|
d6c2111868 | ||
|
|
9dfffbb8f2 |
|
|
@ -3,8 +3,8 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : (Overview .github) READIT.md
|
! Doc Name : (Overview .github) READIT.md
|
||||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nul None <nul@none.org>
|
! Contributors : Nul None <nul@none.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-20>
|
! Created On : <2025-06-20>
|
||||||
! Last Modified : <2025-06-20>
|
! Last Modified : <2025-06-20>
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,10 @@ jobs:
|
||||||
echo "Event 名: ${{ github.event_name }}"
|
echo "Event 名: ${{ github.event_name }}"
|
||||||
|
|
||||||
# 2025-10-06 移除点赞的步骤
|
# 2025-10-06 移除点赞的步骤
|
||||||
# 因原 peter-evans/create-or-update-comment@v4 已不再支持空body,而如果使用 Github Token 之类又过于大材小用因此移除
|
# 因原 peter-evans/create-or-update-comment@v5 已不再支持空body,而如果使用 Github Token 之类又过于大材小用因此移除
|
||||||
|
|
||||||
- name: 添加评论欢迎 PRer
|
- name: 添加评论欢迎 PRer
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
with:
|
with:
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
body: |
|
body: |
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 测试构建情况
|
- name: 测试构建情况
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -51,7 +51,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 创建测试文件
|
- name: 创建测试文件
|
||||||
shell: powershell
|
shell: powershell
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 构建
|
- name: 构建
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 安装 GCC
|
- name: 安装 GCC
|
||||||
uses: msys2/setup-msys2@v2
|
uses: msys2/setup-msys2@v2
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# Contributors : Nul None <nul@none.org>
|
# Contributors : Nul None <nul@none.org>
|
||||||
# |
|
# |
|
||||||
# Created On : <2023-09-15>
|
# Created On : <2023-09-15>
|
||||||
# Last Modified : <2025-09-12>
|
# Last Modified : <2025-12-18>
|
||||||
#
|
#
|
||||||
# Build chsrc on macOS and upload it to GitHub: the 'pre' release
|
# Build chsrc on macOS and upload it to GitHub: the 'pre' release
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
@ -20,7 +20,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 检查编译器版本
|
- name: 检查编译器版本
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -48,11 +48,13 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
on-x64:
|
on-x64:
|
||||||
runs-on: macos-13 # macos-14 is AArch64(ARMv8-A)
|
# macos-13 是 x64,macos-14 是 AArch64(ARMv8-A)
|
||||||
|
# 但是 macos-13 已经于 2025-12-04 下线
|
||||||
|
runs-on: macos-15-intel
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 检查编译器版本
|
- name: 检查编译器版本
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# Contributors : 曾奥然 <ccmywish@qq.com>
|
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-10>
|
# Created On : <2025-06-10>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-10-29>
|
||||||
#
|
#
|
||||||
# Build and publish deb packages
|
# Build and publish deb packages
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
@ -30,7 +30,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: gh-build
|
ref: gh-build
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ jobs:
|
||||||
|
|
||||||
elif [ "${{ github.event_name }}" = "push" ];then
|
elif [ "${{ github.event_name }}" = "push" ];then
|
||||||
# 从源代码中提取版本号
|
# 从源代码中提取版本号
|
||||||
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/chsrc-main.c)
|
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/framework/version.h)
|
||||||
|
|
||||||
else
|
else
|
||||||
version="${{ github.event.inputs.version }}"
|
version="${{ github.event.inputs.version }}"
|
||||||
|
|
@ -73,7 +73,7 @@ jobs:
|
||||||
|
|
||||||
* Release version $version
|
* Release version $version
|
||||||
|
|
||||||
-- Aoran Zeng <ccmywish@qq.com> $(date -R)
|
-- 曾奥然 <ccmywish@qq.com> $(date -R)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ jobs:
|
||||||
bash pkg/deb/deb-installation-test.sh
|
bash pkg/deb/deb-installation-test.sh
|
||||||
|
|
||||||
- name: 上传deb包到artifacts
|
- name: 上传deb包到artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: chsrc-deb-files
|
name: chsrc-deb-files
|
||||||
path: dist/chsrc_*.deb
|
path: dist/chsrc_*.deb
|
||||||
|
|
@ -154,7 +154,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v5
|
uses: actions/download-artifact@v7
|
||||||
with:
|
with:
|
||||||
pattern: chsrc-deb-files
|
pattern: chsrc-deb-files
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
@ -172,7 +172,7 @@ jobs:
|
||||||
dpkg-scanpackages . /dev/null > Packages
|
dpkg-scanpackages . /dev/null > Packages
|
||||||
|
|
||||||
- name: Upload repository metadata
|
- name: Upload repository metadata
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: debian-repository-metadata
|
name: debian-repository-metadata
|
||||||
path: debs/Packages*
|
path: debs/Packages*
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
*.dll
|
*.dll
|
||||||
*.out
|
*.out
|
||||||
*.exe
|
*.exe
|
||||||
|
*.res
|
||||||
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : (for VS Code users) README.md
|
! Doc Name : (for VS Code users) README.md
|
||||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nul None <nul@none.org>
|
! Contributors : Nul None <nul@none.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-18>
|
! Created On : <2025-06-18>
|
||||||
! Last Modified : <2025-06-20>
|
! Last Modified : <2025-06-20>
|
||||||
|
|
|
||||||
13
Makefile
13
Makefile
|
|
@ -2,13 +2,13 @@
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Build File : Makefile
|
# Build File : Makefile
|
||||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||||
# | sanchuanhehe <wyihe5520@gmail.com>
|
# | sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# |
|
# |
|
||||||
# Created On : <2023-08-28>
|
# Created On : <2023-08-28>
|
||||||
# Last Modified : <2025-07-22>
|
# Last Modified : <2025-10-15>
|
||||||
#
|
#
|
||||||
# 请阅读 ./doc/01-开发与构建.md 来使用
|
# 请阅读 ./doc/01-开发与构建.md 来使用
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
@ -26,10 +26,12 @@ ifeq ($(shell uname), Darwin)
|
||||||
On-macOS = 1
|
On-macOS = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# 只有Windows会定义$(OS)变量
|
# 只有 MSYS2 会定义 $(OS) 变量
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
On-Windows = 1
|
On-Windows = 1
|
||||||
endif
|
endif
|
||||||
|
# 注意, 原生 Windows 会定义 $(ComSpec) 变量,且区分大小写
|
||||||
|
# 但是 MSYS2 并不会定义
|
||||||
#=====================================
|
#=====================================
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -196,6 +198,7 @@ test-cli: $(DevMode-Target-Name)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-@rm *.exe 2>/dev/null
|
-@rm *.exe 2>/dev/null
|
||||||
|
-@rm *.res 2>/dev/null
|
||||||
-@rm xy 2>/dev/null
|
-@rm xy 2>/dev/null
|
||||||
-@rm fw 2>/dev/null
|
-@rm fw 2>/dev/null
|
||||||
-@rm README.md.bak* 2>/dev/null
|
-@rm README.md.bak* 2>/dev/null
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : (chsrc-bootstrap Introduction.md)
|
! Doc Name : (chsrc-bootstrap Introduction.md)
|
||||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nul None <nul@none.org>
|
! Contributors : Nul None <nul@none.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-07-12>
|
! Created On : <2025-07-12>
|
||||||
! Last Modified : <2025-07-22>
|
! Last Modified : <2025-07-22>
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : 01-开发与构建.md
|
! Doc Name : 01-开发与构建.md
|
||||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nul None <nul@none.org>
|
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||||
! |
|
! |
|
||||||
! Created On : <2024-12-27>
|
! Created On : <2024-12-27>
|
||||||
! Last Modified : <2025-08-22>
|
! Last Modified : <2025-10-11>
|
||||||
! ---------------------------------------------------------- -->
|
! ---------------------------------------------------------- -->
|
||||||
|
|
||||||
# 开发 chsrc
|
# 开发 chsrc
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
! Contributors : Nul None <nul@none.org>
|
! Contributors : Nul None <nul@none.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2024-08-19>
|
! Created On : <2024-08-19>
|
||||||
! Last Modified : <2025-08-22>
|
! Last Modified : <2025-10-28>
|
||||||
! ---------------------------------------------------------- -->
|
! ---------------------------------------------------------- -->
|
||||||
|
|
||||||
# Write A Recipe Even If You Don't Know C
|
# Write A Recipe Even If You Don't Know C
|
||||||
|
|
@ -89,7 +89,8 @@
|
||||||
|
|
||||||
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
|
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
|
||||||
2. `xy.h` 中以 `xy_` 开头的所有函数或宏
|
2. `xy.h` 中以 `xy_` 开头的所有函数或宏
|
||||||
3. `chec.c` `chef-helper.c` 中以 `chef_` 开头的所有函数或宏
|
3. `chec.c` 中以 `chef_` 开头的所有函数或宏
|
||||||
|
4. `helper.c` 中以 `hp_` 开头的所有函数或宏
|
||||||
|
|
||||||
一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀
|
一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀
|
||||||
|
|
||||||
|
|
|
||||||
10
doc/chsrc.1
10
doc/chsrc.1
|
|
@ -2,14 +2,14 @@
|
||||||
.\" SPDX-License-Identifier: GFDL-1.3-or-later
|
.\" SPDX-License-Identifier: GFDL-1.3-or-later
|
||||||
.\" --------------------------------------------------------------
|
.\" --------------------------------------------------------------
|
||||||
.\" Doc Type : Man Page
|
.\" Doc Type : Man Page
|
||||||
.\" Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
.\" Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
.\" Contributors : Nul None <nul@none.org>
|
.\" Contributors : Nul None <nul@none.org>
|
||||||
.\" |
|
.\" |
|
||||||
.\" Created On : <2024-08-21>
|
.\" Created On : <2024-08-21>
|
||||||
.\" Last Modified : <2025-08-11>
|
.\" Last Modified : <2025-10-29>
|
||||||
.\" --------------------------------------------------------------
|
.\" ----------------------------------------------------------------
|
||||||
|
|
||||||
.TH chsrc 1 "2025-08-11" "v0.2.2.3" "RubyMetric chsrc"
|
.TH chsrc 1 "2025-10-29" "v0.2.3.1" "RubyMetric chsrc"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
chsrc - Change Source for every software on every platform from the command line
|
chsrc - Change Source for every software on every platform from the command line
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,29 @@
|
||||||
@c SPDX-License-Identifier: GFDL-1.3-or-later
|
@c SPDX-License-Identifier: GFDL-1.3-or-later
|
||||||
@c --------------------------------------------------------------
|
@c --------------------------------------------------------------
|
||||||
@c Doc Type : Texinfo
|
@c Doc Type : Texinfo
|
||||||
@c Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
@c Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
@c Contributors : Nul None <nul@none.org>
|
@c Contributors : Nul None <nul@none.org>
|
||||||
@c |
|
@c |
|
||||||
@c Created On : <2024-08-22>
|
@c Created On : <2024-08-22>
|
||||||
@c Last Modified : <2025-08-11>
|
@c Last Modified : <2025-10-29>
|
||||||
@c --------------------------------------------------------------
|
@c --------------------------------------------------------------
|
||||||
|
|
||||||
\input texinfo
|
\input texinfo
|
||||||
@setfilename chsrc.info
|
@setfilename chsrc.info
|
||||||
@settitle chsrc
|
@settitle chsrc
|
||||||
|
|
||||||
@set Chsrc_Version v0.2.2.3
|
@set Chsrc_Version v0.2.3.1
|
||||||
@set Doc_Publish_Date 2025-08-11
|
@set Doc_Publish_Date 2025-10-29
|
||||||
|
|
||||||
@copying
|
@copying
|
||||||
@comment 这是软件copyright,不是文档copyright,因此不放在titlepage
|
@comment 这是软件copyright,不是文档copyright,因此不放在titlepage
|
||||||
Copyright @copyright{} 2025 Aoran Zeng, Heng Guo
|
Copyright @copyright{} 2025 曾奥然, 郭恒
|
||||||
@end copying
|
@end copying
|
||||||
|
|
||||||
@titlepage
|
@titlepage
|
||||||
@title chsrc printed manual
|
@title chsrc printed manual
|
||||||
@subtitle Change Source everywhere for every software!
|
@subtitle Change Source everywhere for every software!
|
||||||
@author Aoran Zeng
|
@author 曾奥然
|
||||||
@c @insertcopying
|
@c @insertcopying
|
||||||
For chsrc @value{Chsrc_Version}
|
For chsrc @value{Chsrc_Version}
|
||||||
@page
|
@page
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<g>
|
||||||
|
<path d="M13.392,207.176L130.909,79.868L369.203,79.868L486.608,207.055L486.608,210.821L255.801,459.814L244.311,459.814L13.392,210.7L13.392,207.176ZM250.056,118.434C186.007,118.434 134.008,170.433 134.008,234.482C134.008,298.53 186.007,350.53 250.056,350.53C314.104,350.53 366.104,298.53 366.104,234.482C366.104,170.433 314.104,118.434 250.056,118.434Z" style="fill:#a52019;"/>
|
||||||
|
<path d="M189.09,222.379C183.346,222.379 178.683,217.716 178.683,211.972C178.683,209.1 179.849,206.498 181.733,204.614L204.205,182.142C204.253,182.092 204.302,182.042 204.351,181.993C208.413,177.931 215.007,177.931 219.069,181.993C223.131,186.055 223.131,192.649 219.069,196.711C219.02,196.76 218.97,196.808 218.921,196.856L214.212,201.565L312.183,201.565C317.927,201.565 322.59,206.228 322.59,211.972C322.59,217.716 317.927,222.379 312.183,222.379L189.09,222.379Z" style="fill:#a52019;"/>
|
||||||
|
<path d="M311.547,245.378C317.29,245.378 321.954,250.042 321.954,255.785C321.954,258.657 320.788,261.259 318.904,263.143L296.431,285.616C296.383,285.665 296.335,285.715 296.286,285.764C292.224,289.826 285.629,289.826 281.568,285.764C277.506,281.703 277.506,275.108 281.568,271.046C281.617,270.997 281.666,270.949 281.716,270.901L286.424,266.193L188.453,266.193C182.71,266.193 178.046,261.529 178.046,255.785C178.046,250.042 182.71,245.378 188.453,245.378L311.547,245.378Z" style="fill:#a52019;"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.8 KiB |
31
justfile
31
justfile
|
|
@ -2,12 +2,12 @@
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Build File : justfile
|
# Build File : justfile
|
||||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
# Contributors : Nul None <nul@none.org>
|
# Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-18>
|
# Created On : <2025-06-18>
|
||||||
# Last Modified : <2025-07-21>
|
# Last Modified : <2025-10-15>
|
||||||
#
|
#
|
||||||
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
|
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
|
||||||
# GNU make 以及相应的 MSYS2、Cygwin 环境
|
# GNU make 以及相应的 MSYS2、Cygwin 环境
|
||||||
|
|
@ -104,9 +104,9 @@ alias c := clean
|
||||||
default: build-in-dev-mode
|
default: build-in-dev-mode
|
||||||
|
|
||||||
build-in-dev-mode:
|
build-in-dev-mode:
|
||||||
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
|
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
|
||||||
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
|
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
|
||||||
@echo Finished: Build in DEV mode
|
@echo Finished: Build in DEV mode
|
||||||
|
|
||||||
build-in-debug-mode:
|
build-in-debug-mode:
|
||||||
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
|
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
|
||||||
|
|
@ -114,9 +114,17 @@ build-in-debug-mode:
|
||||||
@echo Finished: Build in DEBUG mode
|
@echo Finished: Build in DEBUG mode
|
||||||
|
|
||||||
build-in-release-mode:
|
build-in-release-mode:
|
||||||
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
|
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
|
||||||
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}}
|
@{{ if os() == 'windows' { \
|
||||||
@echo Finished: Build in RELEASE mode
|
'(if exist chsrc.res del chsrc.res)' + \
|
||||||
|
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
|
||||||
|
} else { '' } }}
|
||||||
|
@{{ if os() == 'windows' { \
|
||||||
|
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
|
||||||
|
} else { \
|
||||||
|
CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
|
||||||
|
} }}
|
||||||
|
@echo Finished: Build in RELEASE mode
|
||||||
|
|
||||||
debug: build-in-debug-mode
|
debug: build-in-debug-mode
|
||||||
@{{DEBUGGER}} {{DebugMode-Target-Name}}
|
@{{DEBUGGER}} {{DebugMode-Target-Name}}
|
||||||
|
|
@ -140,6 +148,7 @@ test-cli:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-@{{BIN_rm}} *.exe
|
-@{{BIN_rm}} *.exe
|
||||||
|
-@{{BIN_rm}} *.res
|
||||||
-@{{BIN_rm}} xy
|
-@{{BIN_rm}} xy
|
||||||
-@{{BIN_rm}} fw
|
-@{{BIN_rm}} fw
|
||||||
-@{{BIN_rm}} chsrc
|
-@{{BIN_rm}} chsrc
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Lefthook File : lefthook.yml
|
||||||
|
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
|
# Contributors : Nul None <nul@none.org>
|
||||||
|
# |
|
||||||
|
# Created On : <2025-10-28>
|
||||||
|
# Last Modified : <2025-10-30>
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
min_version: 2.0.1
|
||||||
|
|
||||||
|
pre-commit:
|
||||||
|
only:
|
||||||
|
- ref: dev
|
||||||
|
parallel: false
|
||||||
|
jobs:
|
||||||
|
- name: 试运行 DEBUG mode
|
||||||
|
# 触发所有 _prelude() 函数检查
|
||||||
|
run: |
|
||||||
|
just build-in-debug-mode
|
||||||
|
./chsrc-debug get pip
|
||||||
|
glob: "*.{c,h}"
|
||||||
|
exclude: test/*
|
||||||
|
|
||||||
|
- name: 测试 xy.h
|
||||||
|
run: just test-xy
|
||||||
|
glob:
|
||||||
|
- lib/xy.h
|
||||||
|
- test/xy.c
|
||||||
|
|
||||||
|
- name: 测试 framework
|
||||||
|
run: just test-fw
|
||||||
|
glob:
|
||||||
|
- "src/framework/*.{c,h}"
|
||||||
|
- src/chsrc-main.c
|
||||||
|
- test/fw.c
|
||||||
|
|
||||||
|
post-merge:
|
||||||
|
only:
|
||||||
|
- ref: main
|
||||||
|
jobs:
|
||||||
|
- name: 测试编译 DEV mode
|
||||||
|
run: just build-in-dev-mode
|
||||||
|
|
||||||
|
pre-push:
|
||||||
|
only:
|
||||||
|
- ref: gh-build
|
||||||
|
jobs:
|
||||||
|
- name: 测试编译 RELEASE mode
|
||||||
|
run: just build-in-release-mode
|
||||||
|
|
||||||
|
- name: 测试运行
|
||||||
|
run: just test-cli
|
||||||
264
lib/xy.h
264
lib/xy.h
|
|
@ -9,7 +9,7 @@
|
||||||
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-28>
|
* Created On : <2023-08-28>
|
||||||
* Last Modified : <2025-10-06>
|
* Last Modified : <2025-10-28>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* xy: 襄阳、咸阳
|
* xy: 襄阳、咸阳
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#ifndef XY_H
|
#ifndef XY_H
|
||||||
#define XY_H
|
#define XY_H
|
||||||
|
|
||||||
#define _XY_Version "v0.2.1.0-2025/10/06"
|
#define _XY_Version "v0.2.2.0-2025/10/28"
|
||||||
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
|
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
|
||||||
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
|
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
|
||||||
|
|
||||||
|
|
@ -72,6 +72,8 @@ struct
|
||||||
bool on_bsd;
|
bool on_bsd;
|
||||||
bool on_android;
|
bool on_android;
|
||||||
|
|
||||||
|
/* @flavor 同 just 中的 os_family(),只区分 windows, unix */
|
||||||
|
char *os_family;
|
||||||
char *os_devnull;
|
char *os_devnull;
|
||||||
}
|
}
|
||||||
xy =
|
xy =
|
||||||
|
|
@ -88,6 +90,7 @@ xy =
|
||||||
.on_bsd = false,
|
.on_bsd = false,
|
||||||
.on_android = false,
|
.on_android = false,
|
||||||
|
|
||||||
|
.os_family = NULL,
|
||||||
.os_devnull = NULL
|
.os_devnull = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -122,17 +125,31 @@ xy =
|
||||||
|
|
||||||
#define assert_str(a, b) assert (xy_streql ((a), (b)))
|
#define assert_str(a, b) assert (xy_streql ((a), (b)))
|
||||||
|
|
||||||
#define xy_panic(reason) assert(!reason)
|
#define xy_throw(reason) assert(!reason)
|
||||||
|
|
||||||
// @flavor Perl, PHP, Raku
|
/**
|
||||||
#define die xy_panic
|
* @depreacated 避免消极用语
|
||||||
|
*
|
||||||
|
* @flavor Perl, PHP, Raku
|
||||||
|
*/
|
||||||
|
// #define die xy_throw
|
||||||
|
|
||||||
#define xy_unsupported() xy_panic("Unsuppoted")
|
/**
|
||||||
#define xy_unimplemented() xy_panic("Unimplemented temporarily")
|
* @depreacated 避免消极用语
|
||||||
#define xy_unreached() xy_panic("This code shouldn't be reached")
|
*/
|
||||||
#define xy_cant_be_null(p) if(!p) xy_panic("This pointer can't be null")
|
// #define xy_panic xy_throw
|
||||||
|
|
||||||
|
#define xy_unsupported() xy_throw("Unsuppoted")
|
||||||
|
#define xy_unimplemented() xy_throw("Unimplemented temporarily")
|
||||||
|
#define xy_unreached() xy_throw("This code shouldn't be reached")
|
||||||
|
#define xy_cant_be_null(p) if(!p) xy_throw("This pointer can't be null")
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_xy_internal_warn (char *str)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "[xy.h] %s\n", str);
|
||||||
|
}
|
||||||
|
|
||||||
static void _xy_print_int (int n) {printf ("%d", n);}
|
static void _xy_print_int (int n) {printf ("%d", n);}
|
||||||
static void _xy_print_long (long n) {printf ("%ld", n);}
|
static void _xy_print_long (long n) {printf ("%ld", n);}
|
||||||
|
|
@ -164,7 +181,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
|
||||||
bool: _xy_print_bool, \
|
bool: _xy_print_bool, \
|
||||||
char *: _xy_print_str, \
|
char *: _xy_print_str, \
|
||||||
const char *: _xy_print_const_str, \
|
const char *: _xy_print_const_str, \
|
||||||
default: xy_panic("Unsupported type for print()!") \
|
default: xy_throw("Unsupported type for print()!") \
|
||||||
)(x)
|
)(x)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -179,7 +196,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
|
||||||
bool: _xy_println_bool, \
|
bool: _xy_println_bool, \
|
||||||
char *: _xy_println_str, \
|
char *: _xy_println_str, \
|
||||||
const char *: _xy_println_const_str, \
|
const char *: _xy_println_const_str, \
|
||||||
default: xy_panic("Unsupported type for println()/say()!") \
|
default: xy_throw("Unsupported type for println()/say()!") \
|
||||||
)(x)
|
)(x)
|
||||||
/* @flavor Raku, Perl */
|
/* @flavor Raku, Perl */
|
||||||
#define say println
|
#define say println
|
||||||
|
|
@ -204,12 +221,31 @@ xy_malloc0 (size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 替换指针内容并自动释放旧内存
|
||||||
|
*
|
||||||
|
* @param pptr 指向要被替换内存区域的指针的指针
|
||||||
|
* *pptr 可为 NULL
|
||||||
|
* @param new_mem 新的内存区域
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
xy_ptr_replace (char **pptr, char *new_mem)
|
||||||
|
{
|
||||||
|
xy_cant_be_null (pptr);
|
||||||
|
|
||||||
|
if (*pptr)
|
||||||
|
free (*pptr);
|
||||||
|
|
||||||
|
*pptr = new_mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* String
|
* String
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 将 str 中所有的 pat 字符串替换成 replace,返回一个全新的字符串;也可用作删除、缩小、扩张
|
* @brief 将 str 中所有的 pat 字符串替换成 replace,返回一个全新的字符串
|
||||||
*
|
*
|
||||||
* @flavor Ruby: String#gsub
|
* @flavor Ruby: String#gsub
|
||||||
*
|
*
|
||||||
|
|
@ -344,7 +380,7 @@ xy_strcat (unsigned int count, ...)
|
||||||
}
|
}
|
||||||
if (NULL == ret)
|
if (NULL == ret)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "xy.h: No availble memory!");
|
_xy_internal_warn ("xy_strcat(): No availble memory to allocate!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy (cur, str);
|
strcpy (cur, str);
|
||||||
|
|
@ -370,7 +406,7 @@ xy_strdup (const char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
if (!str)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "xy.h: xy_strdup() called with NULL!\n");
|
_xy_internal_warn ("xy_strdup(): called with NULL!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -470,15 +506,15 @@ xy_streql (const char *str1, const char *str2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
xy_streql_ic(const char *str1, const char *str2)
|
xy_streql_ic (const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
if (NULL == str1 || NULL == str2)
|
if (NULL == str1 || NULL == str2)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len1 = strlen(str1);
|
size_t len1 = strlen (str1);
|
||||||
size_t len2 = strlen(str2);
|
size_t len2 = strlen (str2);
|
||||||
if (len1 != len2)
|
if (len1 != len2)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -486,7 +522,7 @@ xy_streql_ic(const char *str1, const char *str2)
|
||||||
|
|
||||||
for (size_t i = 0; i < len1; i++)
|
for (size_t i = 0; i < len1; i++)
|
||||||
{
|
{
|
||||||
if (tolower(str1[i]) != tolower(str2[i]))
|
if (tolower (str1[i]) != tolower (str2[i]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -560,14 +596,16 @@ xy_str_start_with (const char *str, const char *prefix)
|
||||||
static char *
|
static char *
|
||||||
xy_str_delete_prefix (const char *str, const char *prefix)
|
xy_str_delete_prefix (const char *str, const char *prefix)
|
||||||
{
|
{
|
||||||
char *new = xy_strdup (str);
|
|
||||||
bool yes = xy_str_start_with (str, prefix);
|
bool yes = xy_str_start_with (str, prefix);
|
||||||
if (!yes)
|
if (!yes)
|
||||||
return new;
|
{
|
||||||
|
return xy_strdup (str);
|
||||||
size_t len = strlen (prefix);
|
}
|
||||||
char *cur = new + len;
|
else
|
||||||
return cur;
|
{
|
||||||
|
size_t len = strlen (prefix);
|
||||||
|
return xy_strdup (str + len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -594,23 +632,24 @@ xy_str_delete_suffix (const char *str, const char *suffix)
|
||||||
static char *
|
static char *
|
||||||
xy_str_strip (const char *str)
|
xy_str_strip (const char *str)
|
||||||
{
|
{
|
||||||
char *new = xy_strdup (str);
|
xy_cant_be_null (str);
|
||||||
|
|
||||||
while (strchr ("\n\r\v\t\f ", new[0]))
|
const char *start = str;
|
||||||
{
|
while (*start && strchr ("\n\r\v\t\f ", *start))
|
||||||
new += 1;
|
start++;
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = strlen (new);
|
if ('\0' == *start)
|
||||||
|
return xy_strdup ("");
|
||||||
|
|
||||||
char *last = new + len - 1;
|
const char *end = start + strlen (start) - 1;
|
||||||
|
while (end >= start && strchr ("\n\r\v\t\f ", *end))
|
||||||
|
end--;
|
||||||
|
|
||||||
while (strchr ("\n\r\v\t\f ", *last))
|
size_t len = (size_t) (end - start + 1);
|
||||||
{
|
char *ret = xy_malloc0 (len + 1);
|
||||||
*last = '\0';
|
memcpy (ret, start, len);
|
||||||
last -= 1;
|
ret[len] = '\0';
|
||||||
}
|
return ret;
|
||||||
return new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
@ -724,7 +763,7 @@ xy_file_read (const char *path)
|
||||||
buf[read_bytes] = '\0';
|
buf[read_bytes] = '\0';
|
||||||
|
|
||||||
char *formatted_str = xy_str_gsub (buf, "\r\n", "\n");
|
char *formatted_str = xy_str_gsub (buf, "\r\n", "\n");
|
||||||
formatted_str = xy_str_gsub (formatted_str, "\r", "\n");
|
xy_ptr_replace (&formatted_str, xy_str_gsub (formatted_str, "\r", "\n"));
|
||||||
|
|
||||||
free (buf);
|
free (buf);
|
||||||
|
|
||||||
|
|
@ -929,7 +968,7 @@ xy_run_iter_lines (const char *cmd, unsigned long n, bool (*func) (const char
|
||||||
FILE *stream = popen (cmd, "r");
|
FILE *stream = popen (cmd, "r");
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "xy: 命令执行失败\n");
|
_xy_internal_warn ("xy_run_iter_lines(): popen() failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -994,7 +1033,7 @@ xy_run_get_stdout (const char *cmd, char **output)
|
||||||
FILE *stream = popen (cmd, "r");
|
FILE *stream = popen (cmd, "r");
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "xy: 命令执行失败\n");
|
_xy_internal_warn ("xy_run_get_stdout(): popen() failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1020,21 +1059,6 @@ xy_run_get_stdout (const char *cmd, char **output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @flavor 该函数同 just 中的 os_family(),只区分 windows, unix
|
|
||||||
*
|
|
||||||
* @return 返回 "windows" 或 "unix"
|
|
||||||
*/
|
|
||||||
#define xy_os_family _xy_os_family ()
|
|
||||||
static char *
|
|
||||||
_xy_os_family ()
|
|
||||||
{
|
|
||||||
if (xy.on_windows)
|
|
||||||
return "windows";
|
|
||||||
else
|
|
||||||
return "unix";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 该函数返回所在 os family 的对应字符串
|
* @brief 该函数返回所在 os family 的对应字符串
|
||||||
|
|
@ -1143,13 +1167,19 @@ _xy_win_powershellv5_profile ()
|
||||||
static bool
|
static bool
|
||||||
xy_file_exist (const char *path)
|
xy_file_exist (const char *path)
|
||||||
{
|
{
|
||||||
const char *new_path = path;
|
char *expanded_path = NULL;
|
||||||
|
const char *check_path = path;
|
||||||
|
|
||||||
if (xy_str_start_with (path, "~"))
|
if (xy_str_start_with (path, "~"))
|
||||||
{
|
{
|
||||||
new_path = xy_2strcat (xy_os_home, path + 1);
|
expanded_path = xy_2strcat (xy_os_home, path + 1);
|
||||||
|
check_path = expanded_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 即 F_OK
|
// 0 即 F_OK
|
||||||
return (0==access (new_path, 0)) ? true : false;
|
bool result = (0 == access (check_path, 0)) ? true : false;
|
||||||
|
if (expanded_path) free (expanded_path);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1159,12 +1189,14 @@ xy_file_exist (const char *path)
|
||||||
static bool
|
static bool
|
||||||
xy_dir_exist (const char *path)
|
xy_dir_exist (const char *path)
|
||||||
{
|
{
|
||||||
|
char *allocated_dir = NULL;
|
||||||
const char *dir = path;
|
const char *dir = path;
|
||||||
if (xy.on_windows)
|
if (xy.on_windows)
|
||||||
{
|
{
|
||||||
if (xy_str_start_with (path, "~"))
|
if (xy_str_start_with (path, "~"))
|
||||||
{
|
{
|
||||||
dir = xy_2strcat (xy_os_home, path + 1);
|
allocated_dir = xy_2strcat (xy_os_home, path + 1);
|
||||||
|
dir = allocated_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1174,29 +1206,32 @@ xy_dir_exist (const char *path)
|
||||||
// 也可以用 opendir() #include <dirent.h>
|
// 也可以用 opendir() #include <dirent.h>
|
||||||
DWORD attr = GetFileAttributesA (dir);
|
DWORD attr = GetFileAttributesA (dir);
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
if (attr == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
// Q: 我们应该报错吗?
|
// Q: 我们应该报错吗?
|
||||||
return false;
|
result = false;
|
||||||
}
|
}
|
||||||
else if (attr & FILE_ATTRIBUTE_DIRECTORY)
|
else if (attr & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
if (allocated_dir) free (allocated_dir);
|
||||||
|
return result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int status = system (xy_2strcat ("test -d ", dir));
|
char *tmp_cmd = xy_2strcat ("test -d ", dir);
|
||||||
|
int status = system (tmp_cmd);
|
||||||
if (0==status)
|
free (tmp_cmd);
|
||||||
return true;
|
bool result = (0==status);
|
||||||
else
|
if (allocated_dir) free (allocated_dir);
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1219,13 +1254,17 @@ xy_normalize_path (const char *path)
|
||||||
|
|
||||||
if (xy_str_start_with (new, "~"))
|
if (xy_str_start_with (new, "~"))
|
||||||
{
|
{
|
||||||
new = xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~"));
|
char *tmp = xy_str_delete_prefix (new, "~");
|
||||||
|
char *joined = xy_2strcat (xy_os_home, tmp);
|
||||||
|
free (tmp);
|
||||||
|
xy_ptr_replace (&new, joined);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xy.on_windows)
|
if (xy.on_windows)
|
||||||
return xy_str_gsub (new, "/", "\\");
|
{
|
||||||
else
|
xy_ptr_replace (&new, xy_str_gsub (new, "/", "\\"));
|
||||||
return new;
|
}
|
||||||
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1242,10 +1281,10 @@ xy_parent_dir (const char *path)
|
||||||
char *dir = xy_normalize_path (path);
|
char *dir = xy_normalize_path (path);
|
||||||
|
|
||||||
/* 不管是否为Windows,全部统一使用 / 作为路径分隔符,方便后续处理 */
|
/* 不管是否为Windows,全部统一使用 / 作为路径分隔符,方便后续处理 */
|
||||||
dir = xy_str_gsub (dir, "\\", "/");
|
xy_ptr_replace (&dir, xy_str_gsub (dir, "\\", "/"));
|
||||||
|
|
||||||
if (xy_str_end_with (dir, "/"))
|
if (xy_str_end_with (dir, "/"))
|
||||||
dir = xy_str_delete_suffix (dir, "/");
|
xy_ptr_replace (&dir, xy_str_delete_suffix (dir, "/"));
|
||||||
|
|
||||||
char *last = NULL;
|
char *last = NULL;
|
||||||
|
|
||||||
|
|
@ -1259,17 +1298,24 @@ xy_parent_dir (const char *path)
|
||||||
|
|
||||||
/* Windows上重新使用 \ 作为路径分隔符 */
|
/* Windows上重新使用 \ 作为路径分隔符 */
|
||||||
if (xy.on_windows)
|
if (xy.on_windows)
|
||||||
return xy_str_gsub (dir, "/", "\\");
|
{
|
||||||
else
|
xy_ptr_replace (&dir, xy_str_gsub (dir, "/", "\\"));
|
||||||
return dir;
|
}
|
||||||
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal 仅由 xy_init () 调用
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
xy_detect_os ()
|
_xy_detect_os ()
|
||||||
{
|
{
|
||||||
// C:
|
/**
|
||||||
|
* 首先判断是否为 Windows
|
||||||
|
*
|
||||||
|
* SystemDrive 为 C:
|
||||||
|
*/
|
||||||
char *drive = getenv ("SystemDrive");
|
char *drive = getenv ("SystemDrive");
|
||||||
if (drive)
|
if (drive)
|
||||||
{
|
{
|
||||||
|
|
@ -1279,25 +1325,39 @@ xy_detect_os ()
|
||||||
if (d)
|
if (d)
|
||||||
{
|
{
|
||||||
xy.on_windows = true;
|
xy.on_windows = true;
|
||||||
|
xy.os_family = "windows";
|
||||||
closedir (d);
|
closedir (d);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 判断 Linux */
|
||||||
FILE *fp = fopen ("/proc/version", "r");
|
FILE *fp = fopen ("/proc/version", "r");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
char buf[256] = {0};
|
char buf[256] = {0};
|
||||||
fread (buf, 1, sizeof(buf) - 1, fp);
|
fread (buf, 1, sizeof (buf) - 1, fp);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
if (strstr (buf, "Android"))
|
if (strstr (buf, "Linux"))
|
||||||
{
|
|
||||||
xy.on_android = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (strstr (buf, "Linux"))
|
|
||||||
{
|
{
|
||||||
xy.on_linux = true;
|
xy.on_linux = true;
|
||||||
|
xy.os_family = "unix";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 Android
|
||||||
|
*
|
||||||
|
* @consult https://android.googlesource.com/platform/system/core/+/refs/heads/main/rootdir/init.environ.rc.in
|
||||||
|
*/
|
||||||
|
char *android_env = getenv ("ANDROID_ROOT");
|
||||||
|
if (android_env)
|
||||||
|
{
|
||||||
|
if (xy_str_find (android_env, "/system").found)
|
||||||
|
{
|
||||||
|
xy.on_android = true;
|
||||||
|
xy.os_family = "unix";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1311,32 +1371,40 @@ xy_detect_os ()
|
||||||
if (d)
|
if (d)
|
||||||
{
|
{
|
||||||
xy.on_macos = true;
|
xy.on_macos = true;
|
||||||
|
xy.os_family = "unix";
|
||||||
closedir (d);
|
closedir (d);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 最后判断 BSD */
|
/* 最后判断 BSD */
|
||||||
fp = popen ("uname -s", "r");
|
fp = popen ("uname -s", "r");
|
||||||
if (!fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
if (opendir ("/etc/rc.d"))
|
char buf[256];
|
||||||
|
fgets (buf, sizeof (buf), fp);
|
||||||
|
pclose (fp);
|
||||||
|
if (strstr (buf, "BSD") != NULL)
|
||||||
{
|
{
|
||||||
closedir (d);
|
|
||||||
xy.on_bsd = true;
|
xy.on_bsd = true;
|
||||||
|
xy.os_family = "unix";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[256];
|
DIR *bsd_dir = opendir ("/etc/rc.d");
|
||||||
fgets (buf, sizeof (buf), fp);
|
if (bsd_dir)
|
||||||
pclose (fp);
|
{
|
||||||
if (strstr (buf, "BSD") != NULL)
|
closedir (bsd_dir);
|
||||||
xy.on_bsd = true;
|
xy.on_bsd = true;
|
||||||
|
xy.os_family = "unix";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(xy.on_windows || xy.on_linux || xy.on_android || xy.on_macos || xy.on_bsd))
|
if (!(xy.on_windows || xy.on_linux || xy.on_android || xy.on_macos || xy.on_bsd))
|
||||||
xy_panic ("Unknown operating system");
|
xy_throw ("Unknown operating system");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1355,7 +1423,7 @@ xy_use_utf8 ()
|
||||||
void
|
void
|
||||||
xy_init ()
|
xy_init ()
|
||||||
{
|
{
|
||||||
xy_detect_os ();
|
_xy_detect_os ();
|
||||||
|
|
||||||
if (xy.on_windows)
|
if (xy.on_windows)
|
||||||
xy.os_devnull = "nul";
|
xy.os_devnull = "nul";
|
||||||
|
|
@ -1445,7 +1513,7 @@ xy_seq_at (XySeq_t *seq, int n)
|
||||||
{
|
{
|
||||||
xy_cant_be_null (seq);
|
xy_cant_be_null (seq);
|
||||||
|
|
||||||
if (0 == n) xy_panic ("The index must begin from 1, not 0");
|
if (0 == n) xy_throw ("The index must begin from 1, not 0");
|
||||||
|
|
||||||
if (1 == n) return seq->first_item ? seq->first_item->data : NULL;
|
if (1 == n) return seq->first_item ? seq->first_item->data : NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : README.md
|
! Doc Name : README.md
|
||||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nil Null <nil@null.org>
|
! Contributors : Nil Null <nil@null.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-15>
|
! Created On : <2025-06-15>
|
||||||
! Last Modified : <2025-06-16>
|
! Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : BUILD.md
|
! Doc Name : BUILD.md
|
||||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
! Contributors : 曾奥然 <ccmywish@qq.com>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-14>
|
! Created On : <2025-06-14>
|
||||||
! Last Modified : <2025-06-16>
|
! Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : CI.md
|
! Doc Name : CI.md
|
||||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
! Contributors : 曾奥然 <ccmywish@qq.com>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-14>
|
! Created On : <2025-06-14>
|
||||||
! Last Modified : <2025-06-16>
|
! Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Build File : Makefile
|
# Build File : Makefile
|
||||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-14>
|
# Created On : <2025-06-14>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : README.md
|
! Doc Name : README.md
|
||||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
! | Aoran Zeng <ccmywish@qq.com>
|
! | 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nil Null <nil@null.org>
|
! Contributors : Nil Null <nil@null.org>
|
||||||
! |
|
! |
|
||||||
! Created On : <2025-06-14>
|
! Created On : <2025-06-14>
|
||||||
! Last Modified : <2025-06-16>
|
! Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Test File : deb-installation-test.sh
|
# Test File : deb-installation-test.sh
|
||||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-14>
|
# Created On : <2025-06-14>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-06-16>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
|
chsrc (0.2.3-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* v0.2.3 已发布
|
||||||
|
|
||||||
|
-- 曾奥然 <ccmywish@qq.com> Wed, 29 Oct 2025 11:29:05 +0800
|
||||||
|
|
||||||
|
|
||||||
chsrc (0.1.9-1) unstable; urgency=medium
|
chsrc (0.1.9-1) unstable; urgency=medium
|
||||||
|
|
||||||
* v0.1.9 已发布
|
* v0.1.9 已发布
|
||||||
|
|
||||||
-- Aoran Zeng <ccmywish@qq.com> Sun, 15 Jun 2025 13:32:50 +0800
|
-- 曾奥然 <ccmywish@qq.com> Sun, 15 Jun 2025 13:32:50 +0800
|
||||||
|
|
||||||
|
|
||||||
chsrc (0.0.1-1) unstable; urgency=medium
|
chsrc (0.0.1-1) unstable; urgency=medium
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: chsrc
|
Upstream-Name: chsrc
|
||||||
Upstream-Contact: Aoran Zeng <ccmywish@qq.com>
|
Upstream-Contact: 曾奥然 <ccmywish@qq.com>
|
||||||
Source: https://github.com/RubyMetric/chsrc
|
Source: https://github.com/RubyMetric/chsrc
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
|
||||||
2023-2025 Heng Guo <2085471348@qq.com>
|
2023-2025 郭恒 <2085471348@qq.com>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
Comment: The authors' names are indicated in each source code file's header.
|
Comment: The authors' names are indicated in each source code file's header.
|
||||||
|
|
||||||
Files: lib/xy.h
|
Files: lib/xy.h
|
||||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
|
||||||
2023-2025 Heng Guo <2085471348@qq.com>
|
2023-2025 郭恒 <2085471348@qq.com>
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
Files: pkg/deb/debian/*
|
Files: pkg/deb/debian/*
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
# deb File : postinst
|
# deb File : postinst
|
||||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# Contributors : Nil Null <nil@null.org>
|
# Contributors : Nil Null <nil@null.org>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-14>
|
# Created On : <2025-06-14>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-06-16>
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
# deb File : prerm
|
# deb File : prerm
|
||||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# Contributors : Nil Null <nil@null.org>
|
# Contributors : Nil Null <nil@null.org>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-14>
|
# Created On : <2025-06-14>
|
||||||
# Last Modified : <2025-06-16>
|
# Last Modified : <2025-06-16>
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Build File : rules
|
# Build File : rules
|
||||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||||
# | Aoran Zeng <ccmywish@qq.com>
|
# | 曾奥然 <ccmywish@qq.com>
|
||||||
# Contributors : Nil Null <nil@null.org>
|
# Contributors : Nil Null <nil@null.org>
|
||||||
# |
|
# |
|
||||||
# Created On : <2025-06-14>
|
# Created On : <2025-06-14>
|
||||||
# Last Modified : <2025-06-20>
|
# Last Modified : <2025-06-20>
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,10 @@
|
||||||
* 然的加入,逐渐成长为互相支持的伙伴。
|
* 然的加入,逐渐成长为互相支持的伙伴。
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
#define Chsrc_Version "0.2.3"
|
|
||||||
#define Chsrc_Release_Date "2025/10/06"
|
|
||||||
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
|
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
|
||||||
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
|
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
|
||||||
|
|
||||||
|
#include "framework/version.h"
|
||||||
#include "framework/core.c"
|
#include "framework/core.c"
|
||||||
#include "framework/chef.c"
|
#include "framework/chef.c"
|
||||||
|
|
||||||
|
|
@ -76,6 +75,7 @@ chsrc_register_contributors ()
|
||||||
// 该 ID 为 Gitee ID
|
// 该 ID 为 Gitee ID
|
||||||
chef_register_contributor ("@hezonglun", "HeZongLun", "hezonglun123456@outlook.com", NULL);
|
chef_register_contributor ("@hezonglun", "HeZongLun", "hezonglun123456@outlook.com", NULL);
|
||||||
chef_register_contributor ("@Young-Lord", "LY", "ly-niko@qq.com", NULL);
|
chef_register_contributor ("@Young-Lord", "LY", "ly-niko@qq.com", NULL);
|
||||||
|
chef_register_contributor ("@MingriLingran", "MingriLingran", "i@linran.moe", NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AI贡献者:
|
* AI贡献者:
|
||||||
|
|
@ -456,7 +456,8 @@ cli_print_version ()
|
||||||
{
|
{
|
||||||
char *version_string = "v" Chsrc_Version " (" Chsrc_Release_Date ")";
|
char *version_string = "v" Chsrc_Version " (" Chsrc_Release_Date ")";
|
||||||
|
|
||||||
char *str = xy_str_gsub (RAWSTR_chsrc_for_v, "@ver@", version_string);
|
char *str = xy_str_gsub (CHINESE ? RAWSTR_chsrc_for_v_CHINESE : RAWSTR_chsrc_for_v_ENGLISH,
|
||||||
|
"@ver@", version_string);
|
||||||
println (str);
|
println (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
* Contributors : BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
* Contributors : BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||||
* Created On : <2025-08-09>
|
* Created On : <2025-08-09>
|
||||||
* Last Modified : <2025-08-27>
|
* Last Modified : <2025-10-27>
|
||||||
*
|
*
|
||||||
* chef DSL: for chefs (recipe makers) to define a target
|
* chef DSL: for chefs (recipe makers) to define a target
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
@ -137,7 +137,7 @@ chef_set_sources_speed_measure_url_with_func (
|
||||||
if (src->url)
|
if (src->url)
|
||||||
{
|
{
|
||||||
/* 为空时才修改 或者里面是脏数据 */
|
/* 为空时才修改 或者里面是脏数据 */
|
||||||
if (NULL==src->speed_measure_url || !chef_is_url (src->speed_measure_url))
|
if (NULL==src->speed_measure_url || !hp_is_url (src->speed_measure_url))
|
||||||
{
|
{
|
||||||
src->speed_measure_url = func (src->url, user_data);
|
src->speed_measure_url = func (src->url, user_data);
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +186,7 @@ chef_allow_english (Target_t *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_forbid_english (Target_t *target)
|
chef_deny_english (Target_t *target)
|
||||||
{
|
{
|
||||||
xy_cant_be_null (target);
|
xy_cant_be_null (target);
|
||||||
target->can_english = false;
|
target->can_english = false;
|
||||||
|
|
@ -226,7 +226,7 @@ chef_allow_user_define (Target_t *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_forbid_user_define (Target_t *target)
|
chef_deny_user_define (Target_t *target)
|
||||||
{
|
{
|
||||||
xy_cant_be_null (target);
|
xy_cant_be_null (target);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
* File Name : core.c
|
* File Name : core.c
|
||||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
* File Authors : @ccmywish
|
||||||
* | 郭恒 <2085471348@qq.com>
|
* | @G_I_Y
|
||||||
* Contributors : Peng Gao <gn3po4g@outlook.com>
|
* Contributors : @Gn3po4g
|
||||||
* | Happy Game <happygame10124@gmail.com>
|
* | @happy-game
|
||||||
* | Yangmoooo <yangmoooo@outlook.com>
|
* | @Yangmoooo
|
||||||
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
* | @BingChunMoLi
|
||||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
* | @Mikachu2333
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2025-09-29>
|
* Last Modified : <2025-12-29>
|
||||||
*
|
*
|
||||||
* chsrc framework
|
* chsrc framework
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "mirror.c"
|
#include "mirror.c"
|
||||||
#include "chef-helper.c"
|
#include "helper.c"
|
||||||
|
|
||||||
#define App_Name "chsrc"
|
#define App_Name "chsrc"
|
||||||
|
|
||||||
|
|
@ -511,7 +511,7 @@ chsrc_check_file (char *path)
|
||||||
int
|
int
|
||||||
query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *input)
|
query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *input)
|
||||||
{
|
{
|
||||||
if (chef_is_url (input))
|
if (hp_is_url (input))
|
||||||
{
|
{
|
||||||
char *msg = ENGLISH ? "Using user-defined sources for this software is not supported at this time, please contact the developers to ask why or request support" : "暂不支持对该软件使用用户自定义源,请联系开发者询问原因或请求支持";
|
char *msg = ENGLISH ? "Using user-defined sources for this software is not supported at this time, please contact the developers to ask why or request support" : "暂不支持对该软件使用用户自定义源,请联系开发者询问原因或请求支持";
|
||||||
chsrc_error (msg);
|
chsrc_error (msg);
|
||||||
|
|
@ -764,7 +764,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||||
}
|
}
|
||||||
else if (!provider_skip && provider_speed_url)
|
else if (!provider_skip && provider_speed_url)
|
||||||
{
|
{
|
||||||
if (chef_is_url (provider_speed_url))
|
if (hp_is_url (provider_speed_url))
|
||||||
{
|
{
|
||||||
url = xy_strdup (provider_speed_url);
|
url = xy_strdup (provider_speed_url);
|
||||||
chsrc_debug ("m", xy_2strcat ("使用镜像站整体测速链接: ", url));
|
chsrc_debug ("m", xy_2strcat ("使用镜像站整体测速链接: ", url));
|
||||||
|
|
@ -777,7 +777,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||||
|
|
||||||
if (dedicated_speed_url)
|
if (dedicated_speed_url)
|
||||||
{
|
{
|
||||||
if (chef_is_url (dedicated_speed_url))
|
if (hp_is_url (dedicated_speed_url))
|
||||||
{
|
{
|
||||||
url = xy_strdup (dedicated_speed_url);
|
url = xy_strdup (dedicated_speed_url);
|
||||||
has_dedicated_speed_url = true;
|
has_dedicated_speed_url = true;
|
||||||
|
|
@ -863,6 +863,9 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||||
char *curl_result = measure_speed_for_url (url);
|
char *curl_result = measure_speed_for_url (url);
|
||||||
double speed = parse_and_say_curl_result (curl_result);
|
double speed = parse_and_say_curl_result (curl_result);
|
||||||
speed_records[i] = speed;
|
speed_records[i] = speed;
|
||||||
|
|
||||||
|
/* 释放 url 内存 */
|
||||||
|
if (url) free (url);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1052,7 +1055,7 @@ chsrc_yield_source (Target_t *t, char *option)
|
||||||
{
|
{
|
||||||
source = t->sources[ProgStatus.leader_selected_index];
|
source = t->sources[ProgStatus.leader_selected_index];
|
||||||
}
|
}
|
||||||
else if (chef_is_url (option))
|
else if (hp_is_url (option))
|
||||||
{
|
{
|
||||||
Source_t tmp = { &UserDefinedProvider, option };
|
Source_t tmp = { &UserDefinedProvider, option };
|
||||||
source = tmp;
|
source = tmp;
|
||||||
|
|
@ -1519,6 +1522,7 @@ chsrc_run_as_bash_file (const char *script_content)
|
||||||
char *cmd = xy_2strcat ("bash ", tmpfile);
|
char *cmd = xy_2strcat ("bash ", tmpfile);
|
||||||
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
||||||
remove (tmpfile);
|
remove (tmpfile);
|
||||||
|
free (tmpfile); /* 释放 tmpfile 路径内存 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1539,6 +1543,7 @@ chsrc_run_as_sh_file (const char *script_content)
|
||||||
char *cmd = xy_2strcat ("sh ", tmpfile);
|
char *cmd = xy_2strcat ("sh ", tmpfile);
|
||||||
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
||||||
remove (tmpfile);
|
remove (tmpfile);
|
||||||
|
free (tmpfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1552,12 +1557,54 @@ chsrc_run_as_pwsh_file (const char *script_content)
|
||||||
FILE *f = chsrc_make_tmpfile ("pwsh_script", ".ps1", false, &tmpfile);
|
FILE *f = chsrc_make_tmpfile ("pwsh_script", ".ps1", false, &tmpfile);
|
||||||
fwrite (script_content, strlen (script_content), 1, f);
|
fwrite (script_content, strlen (script_content), 1, f);
|
||||||
fclose (f);
|
fclose (f);
|
||||||
char *msg = CHINESE ? "即将执行 PowerShell 脚本内容:" : "The PowerShell script content will be executed:";
|
char *msg = CHINESE ? "即将执行 PowerShell (v7以上) 脚本内容:" : "The PowerShell script content will be executed:";
|
||||||
chsrc_note2 (msg);
|
chsrc_note2 (msg);
|
||||||
println (faint(script_content));
|
println (faint(script_content));
|
||||||
char *cmd = xy_2strcat ("pwsh ", tmpfile);
|
char *cmd = xy_2strcat ("pwsh ", tmpfile);
|
||||||
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
||||||
remove (tmpfile);
|
remove (tmpfile);
|
||||||
|
free (tmpfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以 powershell file.ps1 的形式运行脚本内容
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
chsrc_run_as_powershellv5_file (const char *script_content)
|
||||||
|
{
|
||||||
|
char *tmpfile = NULL;
|
||||||
|
FILE *f = chsrc_make_tmpfile ("psv5_script", ".ps1", false, &tmpfile);
|
||||||
|
fwrite (script_content, strlen (script_content), 1, f);
|
||||||
|
fclose (f);
|
||||||
|
char *msg = CHINESE ? "即将执行 PowerShell v5 脚本内容:" : "The PowerShell v5 script content will be executed:";
|
||||||
|
chsrc_note2 (msg);
|
||||||
|
println (faint(script_content));
|
||||||
|
// -ExecutionPolicy Bypass
|
||||||
|
char *cmd = xy_2strcat ("powershell -File ", tmpfile);
|
||||||
|
chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure);
|
||||||
|
remove (tmpfile);
|
||||||
|
free (tmpfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用 pwsh 或 旧的 powershell (v5) 运行脚本内容,优先使用 pwsh
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
chsrc_run_as_powershell_file (const char *script_content)
|
||||||
|
{
|
||||||
|
// if (chsrc_check_program_quietly_when_exist ("pwsh"))
|
||||||
|
if (chsrc_check_program_quietly ("pwsh"))
|
||||||
|
{
|
||||||
|
chsrc_run_as_pwsh_file (script_content);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chsrc_alert2 (CHINESE ? "未检测到 PowerShell 7 及以上版本,默认使用 PowerShell v5"
|
||||||
|
: "PowerShell 7 or above not detected, switch to PowerShell v5");
|
||||||
|
chsrc_run_as_powershellv5_file (script_content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1601,27 +1648,30 @@ chsrc_view_env (const char *var1, ...)
|
||||||
bool first = true;
|
bool first = true;
|
||||||
while (var)
|
while (var)
|
||||||
{
|
{
|
||||||
#ifdef XY_Build_On_Windows
|
if (xy.on_windows)
|
||||||
if (first)
|
|
||||||
{
|
{
|
||||||
cmd = xy_strcat (3, "set ", var, " ");
|
if (first)
|
||||||
first = false;
|
{
|
||||||
|
cmd = xy_strcat (3, "set ", var, " ");
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd = xy_strcat (4, cmd, "& set ", var, " ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd = xy_strcat (4, cmd, "& set ", var, " ");
|
if (first)
|
||||||
|
{
|
||||||
|
cmd = xy_strcat (5, "echo ", var, "=$", var, " ");
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd = xy_strcat (6, cmd, "; echo ", var, "=$", var, " ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (first)
|
|
||||||
{
|
|
||||||
cmd = xy_strcat (5, "echo ", var, "=$", var, " ");
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmd = xy_strcat (6, cmd, "; echo ", var, "=$", var, " ");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
var = va_arg (vars, const char *);
|
var = va_arg (vars, const char *);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1745,7 +1795,7 @@ log_anyway:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note 本函数不会自动在 `str` 末尾添加换行符
|
* @note 本函数不会在 `str` 末尾添加换行符,所以你可能需要在 `str` 中手动添加
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
chsrc_prepend_to_file (const char *str, const char *filename)
|
chsrc_prepend_to_file (const char *str, const char *filename)
|
||||||
|
|
@ -1756,67 +1806,21 @@ chsrc_prepend_to_file (const char *str, const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *file = xy_normalize_path (filename);
|
char *file = xy_normalize_path (filename);
|
||||||
char *dir = xy_parent_dir (file);
|
|
||||||
chsrc_ensure_dir (dir);
|
|
||||||
|
|
||||||
char *tmpfile_path = NULL;
|
char *file_content = xy_file_read (file);
|
||||||
FILE *output = chsrc_make_tmpfile ("prepend", ".txt", false, &tmpfile_path);
|
char *content = xy_2strcat (str, file_content);
|
||||||
|
|
||||||
if (!output)
|
FILE *f = fopen (file, "w");
|
||||||
|
|
||||||
|
if (f)
|
||||||
{
|
{
|
||||||
char *msg = ENGLISH ? xy_2strcat ("Create temp file before Write prepend failed ", file)
|
fwrite (content, 1, strlen (content), f);
|
||||||
: xy_2strcat ("尝试在文件开头写入时创建临时文件失败:", file);
|
fclose (f);
|
||||||
chsrc_error2 (msg);
|
|
||||||
exit (Exit_ExternalError);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/* 先写入要插入的内容 */
|
|
||||||
fprintf (output, "%s", str);
|
|
||||||
|
|
||||||
/* 如果原文件存在,复制其内容到临时文件 */
|
|
||||||
FILE *input = fopen (file, "r");
|
|
||||||
if (input)
|
|
||||||
{
|
{
|
||||||
fseek (input, 0, SEEK_END);
|
chsrc_error2 ("文件打开失败");
|
||||||
long file_size = ftell (input);
|
exit (Exit_UserCause);
|
||||||
fseek (input, 0, SEEK_SET);
|
|
||||||
|
|
||||||
if (file_size > 0)
|
|
||||||
{
|
|
||||||
char *buffer = malloc (file_size);
|
|
||||||
if (buffer == NULL)
|
|
||||||
{
|
|
||||||
fclose (input);
|
|
||||||
fclose (output);
|
|
||||||
remove (tmpfile_path);
|
|
||||||
char *msg = ENGLISH ? "Memory allocation failed" : "内存分配失败";
|
|
||||||
chsrc_error2 (msg);
|
|
||||||
exit (Exit_ExternalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t bytes = fread (buffer, 1, file_size, input);
|
|
||||||
if (bytes > 0)
|
|
||||||
{
|
|
||||||
fwrite (buffer, 1, bytes, output);
|
|
||||||
}
|
|
||||||
free (buffer);
|
|
||||||
}
|
|
||||||
fclose (input);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (output);
|
|
||||||
|
|
||||||
/* 删除原文件(如果存在) */
|
|
||||||
remove (file);
|
|
||||||
|
|
||||||
/* 将临时文件重命名为目标文件 */
|
|
||||||
if (rename (tmpfile_path, file) != 0)
|
|
||||||
{
|
|
||||||
unlink (tmpfile_path);
|
|
||||||
char *msg = ENGLISH ? xy_2strcat ("Write prepend failed to ", file)
|
|
||||||
: xy_2strcat ("在文件开头写入失败: ", file);
|
|
||||||
chsrc_error2 (msg);
|
|
||||||
exit (Exit_ExternalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_anyway:
|
log_anyway:
|
||||||
|
|
@ -1849,6 +1853,7 @@ chsrc_overwrite_file (const char *str, const char *filename)
|
||||||
size_t ret = fwrite (str, len, 1, f);
|
size_t ret = fwrite (str, len, 1, f);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
{
|
{
|
||||||
|
fclose (f);
|
||||||
char *msg = ENGLISH ? xy_2strcat ("Write failed to ", file)
|
char *msg = ENGLISH ? xy_2strcat ("Write failed to ", file)
|
||||||
: xy_2strcat ("写入文件失败: ", file);
|
: xy_2strcat ("写入文件失败: ", file);
|
||||||
chsrc_error2 (msg);
|
chsrc_error2 (msg);
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
/** ------------------------------------------------------------
|
/** ------------------------------------------------------------
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
* File Name : chef-helper.c
|
* File Name : helper.c
|
||||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
* Contributors : Nul None <nul@none.org>
|
* Contributors : Nul None <nul@none.org>
|
||||||
* Created On : <2025-07-14>
|
* Created On : <2025-07-14>
|
||||||
* Last Modified : <2025-08-20>
|
* Last Modified : <2025-10-28>
|
||||||
*
|
*
|
||||||
* For chefs (recipe makers) and sometimes framewoker
|
* For chefs (recipe makers) and sometimes framewoker
|
||||||
* to do some work not releated to OS operations
|
* to do some work not releated to OS operations
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
chef_is_url (const char *str)
|
hp_is_url (const char *str)
|
||||||
{
|
{
|
||||||
return (xy_str_start_with (str, "http://") || xy_str_start_with (str, "https://"));
|
return (xy_str_start_with (str, "http://") || xy_str_start_with (str, "https://"));
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ chef_is_url (const char *str)
|
||||||
* @return 一律返回新字符串
|
* @return 一律返回新字符串
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
chef_remove_trailing_slash (char *str)
|
hp_remove_trailing_slash (char *str)
|
||||||
{
|
{
|
||||||
char *newstr = xy_strdup (str);
|
char *newstr = xy_strdup (str);
|
||||||
size_t len = strlen (newstr);
|
size_t len = strlen (newstr);
|
||||||
|
|
@ -34,7 +34,7 @@ chef_remove_trailing_slash (char *str)
|
||||||
* @return 一律返回新字符串
|
* @return 一律返回新字符串
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
chef_ensure_trailing_slash (char *str)
|
hp_ensure_trailing_slash (char *str)
|
||||||
{
|
{
|
||||||
size_t len = strlen (str);
|
size_t len = strlen (str);
|
||||||
if (len == 0 || str[len - 1] == '/')
|
if (len == 0 || str[len - 1] == '/')
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2025-08-27>
|
* Last Modified : <2025-10-07>
|
||||||
*
|
*
|
||||||
* 通用镜像站
|
* 通用镜像站
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
/** ------------------------------------------------------------
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* File Name : version.h
|
||||||
|
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
|
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||||
|
* Contributors : Nil Null <nil@null.org>
|
||||||
|
* |
|
||||||
|
* Created On : <2025-10-10>
|
||||||
|
* Last Modified : <See 'Chsrc_Release_Date'>
|
||||||
|
*
|
||||||
|
* 发布新版本前请修改此文件
|
||||||
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define Chsrc_Version "0.2.4.0-dev"
|
||||||
|
|
||||||
|
// 以下四个宏仅用于 resource/chsrc.rc
|
||||||
|
#define Chsrc_Version_Major 0
|
||||||
|
#define Chsrc_Version_Minor 2
|
||||||
|
#define Chsrc_Version_Patch 4
|
||||||
|
#define Chsrc_Version_Pre 0
|
||||||
|
|
||||||
|
#define Chsrc_Release_Date "2025/12/29"
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,7 @@
|
||||||
! Config Authors: 曾奥然 <ccmywish@qq.com>
|
! Config Authors: 曾奥然 <ccmywish@qq.com>
|
||||||
! Contributors : Nil Null <nil@null.org>
|
! Contributors : Nil Null <nil@null.org>
|
||||||
! Created On : <2025-07-22>
|
! Created On : <2025-07-22>
|
||||||
! Last Modified : <2025-08-22>
|
! Last Modified : <2025-10-29>
|
||||||
! ---------------------------------------------------------- -->
|
! ---------------------------------------------------------- -->
|
||||||
|
|
||||||
# [rawstr4c] input for chsrc
|
# [rawstr4c] input for chsrc
|
||||||
|
|
@ -132,16 +132,36 @@ MAINTAIN:
|
||||||
|
|
||||||
## for `chsrc -v`
|
## for `chsrc -v`
|
||||||
|
|
||||||
- name = `for__v`
|
- name = `for__v_CHINESE`
|
||||||
|
|
||||||
```
|
```
|
||||||
chsrc @ver@
|
chsrc @ver@
|
||||||
Copyright (C) 2025 Aoran Zeng, Heng Guo
|
|
||||||
|
Copyright (C) 2023-2025 曾奥然, 郭恒
|
||||||
|
许可证 GPLv3+:GNU GPL 第 3 版或更高版本 <https://gnu.org/licenses/gpl.html>
|
||||||
|
这是自由软件:您可以自由修改和分发它。
|
||||||
|
在法律允许的最大范围内,本软件按'原样'提供,不作任何明示或暗示的保证。
|
||||||
|
|
||||||
|
由作者:曾奥然、郭恒,协作者:Mikachu2333、Happy Game 以及各位贡献者开发。(详见 chsrc-main.c, 或 `chsrc ls <target>`)
|
||||||
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## for `chsrc -v -en`
|
||||||
|
|
||||||
|
- name = `for__v_ENGLISH`
|
||||||
|
|
||||||
|
```
|
||||||
|
chsrc @ver@
|
||||||
|
|
||||||
|
Copyright (C) 2023-2025 Aoran Zeng, Heng Guo
|
||||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
There is NO WARRANTY, to the extent permitted by law.
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c)
|
Written by authors: Aoran Zeng, Heng Guo, collaborators: Mikachu2333, Happy Game, and contributors. (See chsrc-main.c, or `chsrc ls <target>`)
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_clojure_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ pl_go_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@czyt", "@techoc");
|
chef_set_sauciers (this, 2, "@czyt", "@techoc");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_haskell_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_java_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
// 阿里巴巴开源镜像站需要修改为此才能测速
|
// 阿里巴巴开源镜像站需要修改为此才能测速
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ pl_lua_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ pl_nuget_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://www.nuget.org/api/v3/", DelegateToUpstream},
|
{&UpstreamProvider, "https://www.nuget.org/api/v3/", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_ocaml_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_php_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -10,26 +10,36 @@ pl_perl_prelude ()
|
||||||
chef_prep_this (pl_perl, gs);
|
chef_prep_this (pl_perl, gs);
|
||||||
|
|
||||||
chef_set_created_on (this, "2023-09-31");
|
chef_set_created_on (this, "2023-09-31");
|
||||||
chef_set_last_updated (this, "2025-08-10");
|
chef_set_last_updated (this, "2025-10-07");
|
||||||
chef_set_sources_last_updated (this, "2025-08-21");
|
chef_set_sources_last_updated (this, "2025-10-07");
|
||||||
|
|
||||||
chef_set_chef (this, NULL);
|
chef_set_chef (this, NULL);
|
||||||
chef_set_cooks (this, 1, "@ccmywish");
|
chef_set_cooks (this, 1, "@ccmywish");
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 2, "@hezonglun", "@Mikachu2333");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english (this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define (this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://www.cpan.org/", DelegateToUpstream},
|
{&UpstreamProvider, "https://www.cpan.org/", FeedByPrelude},
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", DelegateToMirror},
|
{&MirrorZ, "https://mirrors.cernet.edu.cn/CPAN/", FeedByPrelude},
|
||||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", DelegateToMirror},
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", FeedByPrelude},
|
||||||
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", DelegateToMirror},
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", FeedByPrelude},
|
||||||
{&Hust, "https://mirrors.hust.edu.cn/CPAN/", DelegateToMirror},
|
{&Cqu, "https://mirrors.cqu.edu.cn/CPAN/", FeedByPrelude},
|
||||||
{&Ali, "https://mirrors.aliyun.com/CPAN/", DelegateToMirror},
|
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", FeedByPrelude},
|
||||||
{&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/", DelegateToMirror}
|
{&Nju, "https://mirrors.nju.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Nyist, "https://mirror.nyist.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Ustc, "https://mirrors.ustc.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/cpan/", FeedByPrelude},
|
||||||
|
{&Iscas, "https://mirror.iscas.ac.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Zju, "https://mirrors.zju.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Lzuoss, "https://mirrors.lzu.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Hust, "https://mirrors.hust.edu.cn/CPAN/", FeedByPrelude},
|
||||||
|
{&Ali, "https://mirrors.aliyun.com/CPAN/", FeedByPrelude}
|
||||||
def_sources_end()
|
def_sources_end()
|
||||||
|
|
||||||
|
chef_set_sources_speed_measure_url_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by rawstr4c v1.0.0-2025/08/09
|
* Generated by rawstr4c v1.1.0-2025/09/27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char RAWSTR_pl_python_uv_config_source_content[] = "\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x0a\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x0a\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x0a";
|
char RAWSTR_pl_python_uv_config_source_content[] = "\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x0a\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x0a\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x0a";
|
||||||
|
|
||||||
char RAWSTR_pl_python_get_uv_config[] = "\x67\x72\x65\x70\x20\x2d\x41\x20\x32\x20\x27\x69\x6e\x64\x65\x78\x27\x20\x40\x66\x40\x20\x7c\x20\x73\x65\x64\x20\x2d\x6e\x20\x27\x73\x2f\x5e\x75\x72\x6c\x20\x3d\x20\x22\x5c\x28\x2e\x2a\x5c\x29\x22\x2f\x5c\x31\x2f\x70\x27";
|
char RAWSTR_pl_python_get_uv_config[] = "\x67\x72\x65\x70\x20\x2d\x41\x20\x32\x20\x27\x69\x6e\x64\x65\x78\x27\x20\x40\x66\x40\x20\x7c\x20\x73\x65\x64\x20\x2d\x6e\x20\x27\x73\x2f\x5e\x75\x72\x6c\x20\x3d\x20\x22\x5c\x28\x2e\x2a\x5c\x29\x22\x2f\x5c\x31\x2f\x70\x27";
|
||||||
|
|
||||||
char RAWSTR_pl_python_set_uv_config[] = "\x40\x73\x65\x64\x40\x20\x27\x2f\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x2f\x2c\x2f\x5e\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x24\x2f\x7b\x73\x7c\x5e\x75\x72\x6c\x20\x3d\x20\x22\x2e\x2a\x22\x24\x7c\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x7c\x7d\x27\x20\x40\x66\x40";
|
char RAWSTR_pl_python_get_uv_config_on_windows[] = "\x24\x6c\x69\x6e\x65\x73\x20\x3d\x20\x47\x65\x74\x2d\x43\x6f\x6e\x74\x65\x6e\x74\x20\x40\x66\x40\x3b\x0a\x0a\x66\x6f\x72\x28\x24\x69\x6e\x64\x65\x78\x3d\x30\x3b\x20\x24\x69\x6e\x64\x65\x78\x20\x2d\x6c\x74\x20\x24\x6c\x69\x6e\x65\x73\x2e\x43\x6f\x75\x6e\x74\x3b\x20\x24\x69\x6e\x64\x65\x78\x2b\x2b\x29\x20\x7b\x0a\x20\x20\x69\x66\x28\x24\x6c\x69\x6e\x65\x73\x5b\x24\x69\x6e\x64\x65\x78\x5d\x20\x2d\x6d\x61\x74\x63\x68\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x27\x29\x20\x7b\x0a\x20\x20\x20\x20\x24\x6c\x69\x6e\x65\x73\x5b\x24\x69\x6e\x64\x65\x78\x2e\x2e\x28\x24\x69\x6e\x64\x65\x78\x2b\x33\x29\x5d\x0a\x20\x20\x7d\x0a\x7d";
|
||||||
|
|
||||||
|
char RAWSTR_pl_python_set_uv_config[] = "\x40\x73\x65\x64\x40\x20\x27\x2f\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x2f\x2c\x2f\x5e\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x24\x2f\x7b\x73\x7c\x5e\x75\x72\x6c\x20\x3d\x20\x22\x2e\x2a\x22\x24\x7c\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x7c\x3b\x7d\x27\x20\x40\x66\x40";
|
||||||
|
|
||||||
|
char RAWSTR_pl_python_set_uv_config_on_windows[] = "\x70\x6f\x77\x65\x72\x73\x68\x65\x6c\x6c\x20\x2d\x43\x6f\x6d\x6d\x61\x6e\x64\x20\x22\x24\x63\x6f\x6e\x74\x65\x6e\x74\x20\x3d\x20\x47\x65\x74\x2d\x43\x6f\x6e\x74\x65\x6e\x74\x20\x27\x40\x66\x40\x27\x3b\x20\x24\x63\x6f\x6e\x74\x65\x6e\x74\x20\x3d\x20\x24\x63\x6f\x6e\x74\x65\x6e\x74\x20\x2d\x72\x65\x70\x6c\x61\x63\x65\x20\x27\x5e\x75\x72\x6c\x20\x3d\x20\x5c\x22\x2e\x2a\x5c\x22\x24\x27\x2c\x20\x27\x75\x72\x6c\x20\x3d\x20\x5c\x22\x40\x75\x72\x6c\x40\x5c\x22\x27\x3b\x20\x24\x63\x6f\x6e\x74\x65\x6e\x74\x20\x7c\x20\x53\x65\x74\x2d\x43\x6f\x6e\x74\x65\x6e\x74\x20\x27\x40\x66\x40\x27\x22";
|
||||||
|
|
||||||
char RAWSTR_pl_python_test_uv_if_set_source[] = "\x67\x72\x65\x70\x20\x2d\x71\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x24\x27\x20\x40\x66\x40";
|
char RAWSTR_pl_python_test_uv_if_set_source[] = "\x67\x72\x65\x70\x20\x2d\x71\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x24\x27\x20\x40\x66\x40";
|
||||||
|
|
||||||
|
char RAWSTR_pl_python_test_uv_if_set_source_on_windows[] = "\x70\x6f\x77\x65\x72\x73\x68\x65\x6c\x6c\x20\x2d\x43\x6f\x6d\x6d\x61\x6e\x64\x20\x22\x69\x66\x20\x28\x47\x65\x74\x2d\x43\x6f\x6e\x74\x65\x6e\x74\x20\x40\x66\x40\x20\x7c\x20\x53\x65\x6c\x65\x63\x74\x2d\x53\x74\x72\x69\x6e\x67\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x27\x29\x20\x7b\x20\x65\x78\x69\x74\x20\x30\x20\x7d\x20\x65\x6c\x73\x65\x20\x7b\x20\x65\x78\x69\x74\x20\x31\x20\x7d\x22";
|
||||||
|
|
||||||
char RAWSTR_pl_python_rye_config[] = "\x5b\x5b\x73\x6f\x75\x72\x63\x65\x73\x5d\x5d\x0a\x6e\x61\x6d\x65\x20\x3d\x20\x22\x40\x31\x40\x22\x0a\x75\x72\x6c\x20\x20\x3d\x20\x22\x40\x32\x40\x22";
|
char RAWSTR_pl_python_rye_config[] = "\x5b\x5b\x73\x6f\x75\x72\x63\x65\x73\x5d\x5d\x0a\x6e\x61\x6d\x65\x20\x3d\x20\x22\x40\x31\x40\x22\x0a\x75\x72\x6c\x20\x20\x3d\x20\x22\x40\x32\x40\x22";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,12 @@
|
||||||
! SPDX-License-Identifier: GPL-3.0-or-later
|
! SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Config Type : rawstr4c (Markdown)
|
! Config Type : rawstr4c (Markdown)
|
||||||
! Config Authors: Aoran Zeng <ccmywish@qq.com>
|
! Config Authors: @ccmywish
|
||||||
! | happy game <happygame1024@gmail.com>
|
! | @happy-game
|
||||||
! Contributors : Nil Null <nil@null.org>
|
! | @MingriLingran
|
||||||
|
! Contributors : Nil Null <nil@null.org>
|
||||||
! Created On : <2025-07-14>
|
! Created On : <2025-07-14>
|
||||||
! Last Modified : <2025-08-09>
|
! Last Modified : <2025-12-29>
|
||||||
! ---------------------------------------------------------- -->
|
! ---------------------------------------------------------- -->
|
||||||
|
|
||||||
# rawstr4c input for Python
|
# rawstr4c input for Python
|
||||||
|
|
@ -39,10 +40,35 @@ grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Get uv config on Windows
|
||||||
|
|
||||||
|
为什么不用 `Select-String`,原因见: <https://github.com/RubyMetric/chsrc/pull/328#issuecomment-3695577870>
|
||||||
|
|
||||||
|
还有另外一个好处:如果 `[[index]]` 配置被写入了多次,可以这样检查出来
|
||||||
|
|
||||||
|
我们倾向于使用脚本而非命令,因为内容较长,便于用户检查到底执行了什么内容。
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$lines = Get-Content @f@;
|
||||||
|
|
||||||
|
for($index=0; $index -lt $lines.Count; $index++) {
|
||||||
|
if($lines[$index] -match '^\[\[index\]\]$') {
|
||||||
|
$lines[$index..($index+3)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Set uv config
|
### Set uv config
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|}' @f@
|
@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|;}' @f@
|
||||||
|
```
|
||||||
|
|
||||||
|
### Set uv config on Windows
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -Command "$content = Get-Content '@f@'; $content = $content -replace '^url = \".*\"$', 'url = \"@url@\"'; $content | Set-Content '@f@'"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -52,6 +78,12 @@ grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'
|
||||||
grep -q '^\[\[index]]$' @f@
|
grep -q '^\[\[index]]$' @f@
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Test uv if set source on Windows
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -Command "if (Get-Content @f@ | Select-String '^\[\[index\]\]$') { exit 0 } else { exit 1 }"
|
||||||
|
```
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ pl_python_uv_prelude (void)
|
||||||
chef_prep_this (pl_python_uv, gsr);
|
chef_prep_this (pl_python_uv, gsr);
|
||||||
|
|
||||||
chef_set_created_on (this, "2024-12-11");
|
chef_set_created_on (this, "2024-12-11");
|
||||||
chef_set_last_updated (this, "2025-08-09");
|
chef_set_last_updated (this, "2025-12-29");
|
||||||
chef_set_sources_last_updated (this, "2025-08-09");
|
chef_set_sources_last_updated (this, "2025-08-09");
|
||||||
|
|
||||||
chef_set_chef (this, NULL);
|
chef_set_chef (this, NULL);
|
||||||
chef_set_cooks (this, 1, "@happy-game");
|
chef_set_cooks (this, 2, "@happy-game", "@MingriLingran");
|
||||||
chef_set_sauciers (this, 2, "@Kattos", "@ccmywish");
|
chef_set_sauciers (this, 2, "@Kattos", "@ccmywish");
|
||||||
|
|
||||||
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
||||||
|
|
@ -91,8 +91,18 @@ pl_python_uv_getsrc (char *option)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 获取 [[index]] 配置项的 url */
|
/* 获取 [[index]] 配置项的 url */
|
||||||
char *cmd = xy_str_gsub (RAWSTR_pl_python_get_uv_config, "@f@", uv_config);
|
if (xy.on_windows)
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
{
|
||||||
|
/* 在 Windows 上使用 PowerShell 替代 grep */
|
||||||
|
char *script = xy_str_gsub (RAWSTR_pl_python_get_uv_config_on_windows, "@f@", uv_config);
|
||||||
|
chsrc_run_as_powershell_file (script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 在类 Unix 系统上使用 grep */
|
||||||
|
char *cmd = xy_str_gsub (RAWSTR_pl_python_get_uv_config, "@f@", uv_config);
|
||||||
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -119,19 +129,6 @@ pl_python_uv_setsrc (char *option)
|
||||||
|
|
||||||
const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url);
|
const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url);
|
||||||
|
|
||||||
#if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD)
|
|
||||||
char *sed_cmd = "sed -i '' ";
|
|
||||||
#else
|
|
||||||
char *sed_cmd = "sed -i ";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将 [[index]] 到 default = true 之间的 url = ".*" 替换为 url = "source.url"
|
|
||||||
*/
|
|
||||||
char *update_config_cmd = xy_str_gsub (RAWSTR_pl_python_set_uv_config, "@sed@", sed_cmd);
|
|
||||||
update_config_cmd = xy_str_gsub (update_config_cmd, "@f@", uv_config);
|
|
||||||
update_config_cmd = xy_str_gsub (update_config_cmd, "@url@", source.url);
|
|
||||||
|
|
||||||
if (!xy_file_exist (uv_config))
|
if (!xy_file_exist (uv_config))
|
||||||
{
|
{
|
||||||
/* 当 uv_config 不存在,直接写入文件 */
|
/* 当 uv_config 不存在,直接写入文件 */
|
||||||
|
|
@ -140,12 +137,41 @@ pl_python_uv_setsrc (char *option)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* 当 uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾 */
|
/* 当 uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾 */
|
||||||
char *cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source, "@f@", uv_config);
|
char *cmd = NULL;
|
||||||
chsrc_ensure_program ("grep");
|
if (xy.on_windows)
|
||||||
|
{
|
||||||
|
/* 在 Windows 上使用 PowerShell 替代 grep */
|
||||||
|
cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source_on_windows, "@f@", uv_config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source, "@f@", uv_config);
|
||||||
|
}
|
||||||
|
|
||||||
int status = xy_run_get_status (cmd);
|
int status = xy_run_get_status (cmd);
|
||||||
if (0==status)
|
if (0==status)
|
||||||
{
|
{
|
||||||
chsrc_run (update_config_cmd, RunOpt_Default);
|
if (xy.on_windows)
|
||||||
|
{
|
||||||
|
/* 在 Windows 上使用 PowerShell 替代 sed */
|
||||||
|
char *powershell_cmd_with_file = xy_str_gsub(RAWSTR_pl_python_set_uv_config_on_windows, "@f@", uv_config);
|
||||||
|
char *powershell_cmd = xy_str_gsub(powershell_cmd_with_file, "@url@", source.url);
|
||||||
|
chsrc_run (powershell_cmd, RunOpt_Default);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* 非 Windows 系统使用 sed */
|
||||||
|
char *sed_cmd = NULL;
|
||||||
|
#if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD)
|
||||||
|
sed_cmd = "sed -i '' ";
|
||||||
|
#else
|
||||||
|
sed_cmd = "sed -i ";
|
||||||
|
#endif
|
||||||
|
char *update_config_cmd = xy_str_gsub (RAWSTR_pl_python_set_uv_config, "@sed@", sed_cmd);
|
||||||
|
update_config_cmd = xy_str_gsub (update_config_cmd, "@f@", uv_config);
|
||||||
|
update_config_cmd = xy_str_gsub (update_config_cmd, "@url@", source.url);
|
||||||
|
chsrc_run (update_config_cmd, RunOpt_Default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_r_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
// 以下注释的,是不含有bioconductor的镜像站,我们在换cran的同时,也直接帮助用户换bioconductor
|
// 以下注释的,是不含有bioconductor的镜像站,我们在换cran的同时,也直接帮助用户换bioconductor
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ bool
|
||||||
pl_ruby_remove_gem_source (const char *source)
|
pl_ruby_remove_gem_source (const char *source)
|
||||||
{
|
{
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
if (chef_is_url (source))
|
if (hp_is_url (source))
|
||||||
{
|
{
|
||||||
cmd = xy_2strcat ("gem sources -r ", source);
|
cmd = xy_2strcat ("gem sources -r ", source);
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pl_rust_cargo_prelude (void)
|
||||||
chef_set_sauciers (this, 1, "@happy-game");
|
chef_set_sauciers (this, 1, "@happy-game");
|
||||||
|
|
||||||
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
||||||
chef_forbid_english (this);
|
chef_deny_english (this);
|
||||||
chef_allow_user_define (this);
|
chef_allow_user_define (this);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -75,7 +75,6 @@ pl_rust_cargo_getsrc (char *option)
|
||||||
char *raw_content = xy_file_read (cargo_config_file);
|
char *raw_content = xy_file_read (cargo_config_file);
|
||||||
char *formatted_content = xy_str_gsub (raw_content, " ", "");
|
char *formatted_content = xy_str_gsub (raw_content, " ", "");
|
||||||
formatted_content = xy_str_gsub (formatted_content, "'", "\"");
|
formatted_content = xy_str_gsub (formatted_content, "'", "\"");
|
||||||
free (raw_content);
|
|
||||||
|
|
||||||
XyStrFindResult_t result_has_mirror = xy_str_find (formatted_content, "replace-with");
|
XyStrFindResult_t result_has_mirror = xy_str_find (formatted_content, "replace-with");
|
||||||
if (result_has_mirror.found)
|
if (result_has_mirror.found)
|
||||||
|
|
@ -112,7 +111,6 @@ pl_write_rust_config (const char *path, const char *url)
|
||||||
char *content = RAWSTR_pl_rust_cargo_config;
|
char *content = RAWSTR_pl_rust_cargo_config;
|
||||||
content = xy_str_gsub (content, "@url@", url);
|
content = xy_str_gsub (content, "@url@", url);
|
||||||
chsrc_overwrite_file (content, path);
|
chsrc_overwrite_file (content, path);
|
||||||
free (content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -172,7 +170,6 @@ pl_rust_cargo_setsrc (char *option)
|
||||||
|
|
||||||
char *final_content = xy_str_gsub (raw_content, mirror_url, xy_2strcat ("sparse+", source.url));
|
char *final_content = xy_str_gsub (raw_content, mirror_url, xy_2strcat ("sparse+", source.url));
|
||||||
chsrc_overwrite_file (final_content, cargo_config_file);
|
chsrc_overwrite_file (final_content, cargo_config_file);
|
||||||
free (final_content);
|
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ pl_rust_rustup_prelude (void)
|
||||||
chef_set_sauciers (this, 2, "@Yangmoooo", "@Mikachu2333");
|
chef_set_sauciers (this, 2, "@Yangmoooo", "@Mikachu2333");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english (this);
|
chef_deny_english (this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_armbian_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@ccmywish", "@Yangmoooo");
|
chef_set_sauciers (this, 2, "@ccmywish", "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ os_debian_prelude ()
|
||||||
chef_prep_this (os_debian, gsr);
|
chef_prep_this (os_debian, gsr);
|
||||||
|
|
||||||
chef_set_created_on (this, "2023-09-02");
|
chef_set_created_on (this, "2023-09-02");
|
||||||
chef_set_last_updated (this, "2025-09-12");
|
chef_set_last_updated (this, "2025-11-09");
|
||||||
chef_set_sources_last_updated (this, "2025-07-11");
|
chef_set_sources_last_updated (this, "2025-07-11");
|
||||||
|
|
||||||
chef_set_chef (this, NULL);
|
chef_set_chef (this, NULL);
|
||||||
|
|
@ -18,14 +18,14 @@ os_debian_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "http://deb.debian.org/debian", FeedByPrelude},
|
{&UpstreamProvider, "http://deb.debian.org/debian", FeedByPrelude},
|
||||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian/", FeedByPrelude},
|
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian", FeedByPrelude},
|
||||||
{&Ali, "https://mirrors.aliyun.com/debian", FeedByPrelude},
|
{&Ali, "https://mirrors.aliyun.com/debian", FeedByPrelude},
|
||||||
{&Volcengine, "https://mirrors.volces.com/debian", FeedByPrelude},
|
{&Volcengine, "https://mirrors.volces.com/debian", FeedByPrelude},
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian", FeedByPrelude},
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian", FeedByPrelude},
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_kali_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@Yangmoooo", "@happy-game");
|
chef_set_sauciers (this, 2, "@Yangmoooo", "@happy-game");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_linuxlite_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_linuxmint_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@happy-game");
|
chef_set_sauciers (this, 1, "@happy-game");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
|
|
||||||
/* @note 实际上镜像站里的内容和Ubuntu的不太一样 */
|
/* @note 实际上镜像站里的内容和Ubuntu的不太一样 */
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_ros_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@ccmywish", "@zouri");
|
chef_set_sauciers (this, 2, "@ccmywish", "@zouri");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, "该换源方案中,URL存在拼凑,因此不能手动使用某URL来换源", "In this switching method, URLs are constructed, so manual URL specification is not supported");
|
chef_set_note(this, "该换源方案中,URL存在拼凑,因此不能手动使用某URL来换源", "In this switching method, URLs are constructed, so manual URL specification is not supported");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ os_raspberrypi_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_termux_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, "该 recipe 存在对应的 bootstrapper", "This recipe has a corresponding bootstrapper");
|
chef_set_note(this, "该 recipe 存在对应的 bootstrapper", "This recipe has a corresponding bootstrapper");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ os_trisquel_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ os_ubuntu_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@XUANJI233");
|
chef_set_sauciers (this, 1, "@XUANJI233");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_deepin_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ os_openkylin_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@ccmywish");
|
chef_set_sauciers (this, 1, "@ccmywish");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ os_alpine_prelude ()
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_allow_english(this);
|
chef_allow_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_freebsd_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
|
|
||||||
// 2023-09-24: 以下三个USTC, NJU, Netease 均维护了 freebsd-pkg freebsd-ports
|
// 2023-09-24: 以下三个USTC, NJU, Netease 均维护了 freebsd-pkg freebsd-ports
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ os_netbsd_prelude ()
|
||||||
|
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/", DelegateToUpstream},
|
{&UpstreamProvider, "http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/", DelegateToUpstream},
|
||||||
|
|
@ -66,7 +66,7 @@ os_netbsd_setsrc (char *option)
|
||||||
char *vercmd = "cat /etc/os-release | grep \"VERSION=\" | grep -Po \"[8-9].[0-9]+\"";
|
char *vercmd = "cat /etc/os-release | grep \"VERSION=\" | grep -Po \"[8-9].[0-9]+\"";
|
||||||
char *version = xy_run (vercmd, 0);
|
char *version = xy_run (vercmd, 0);
|
||||||
|
|
||||||
char *url = xy_strcat (5, chef_ensure_trailing_slash (source.url), arch, "/", version, "/All");
|
char *url = xy_strcat (5, hp_ensure_trailing_slash (source.url), arch, "/", version, "/All");
|
||||||
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
||||||
|
|
||||||
chsrc_conclude (&source);
|
chsrc_conclude (&source);
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_openbsd_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@hezonglun");
|
chef_set_sauciers (this, 1, "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://cdn.openbsd.org/pub/OpenBSD/", DelegateToUpstream},
|
{&UpstreamProvider, "https://cdn.openbsd.org/pub/OpenBSD/", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ os_gentoo_prelude ()
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_allow_english(this);
|
chef_allow_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ os_solus_prelude ()
|
||||||
|
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ os_voidlinux_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
|
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_almalinux_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Yangmoooo");
|
chef_set_sauciers (this, 1, "@Yangmoooo");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_anolis_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_fedora_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@ccmywish");
|
chef_set_sauciers (this, 1, "@ccmywish");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_rockylinux_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@happy-game");
|
chef_set_sauciers (this, 1, "@happy-game");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://dl.rockylinux.org", DelegateToUpstream},
|
{&UpstreamProvider, "https://dl.rockylinux.org", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_openeuler_prelude ()
|
||||||
chef_set_sauciers (this, 3, "@ccmywish", "@Yangmoooo", "@happy-game");
|
chef_set_sauciers (this, 3, "@ccmywish", "@Yangmoooo", "@happy-game");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_opensuse_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note(this, NULL, NULL);
|
chef_set_note(this, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ os_arch_prelude ()
|
||||||
chef_prep_this (os_arch, gs);
|
chef_prep_this (os_arch, gs);
|
||||||
|
|
||||||
chef_set_created_on (this, "2023-09-05");
|
chef_set_created_on (this, "2023-09-05");
|
||||||
chef_set_last_updated (this, "2025-08-10");
|
chef_set_last_updated (this, "2025-10-30");
|
||||||
chef_set_sources_last_updated (this, "2025-06-20");
|
chef_set_sources_last_updated (this, "2025-06-20");
|
||||||
|
|
||||||
chef_set_chef (this, "@happy-game");
|
chef_set_chef (this, "@happy-game");
|
||||||
|
|
@ -21,8 +21,8 @@ os_arch_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@happy-game", "@Young-Lord");
|
chef_set_sauciers (this, 2, "@happy-game", "@Young-Lord");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this,
|
chef_set_note (this,
|
||||||
"可额外使用 chsrc set archlinuxcn 来更换 Arch Linux CN Repository 源",
|
"可额外使用 chsrc set archlinuxcn 来更换 Arch Linux CN Repository 源",
|
||||||
|
|
@ -78,12 +78,12 @@ os_arch_setsrc (char *option)
|
||||||
if (strncmp(arch, "x86_64", 6)==0)
|
if (strncmp(arch, "x86_64", 6)==0)
|
||||||
{
|
{
|
||||||
is_x86 = true;
|
is_x86 = true;
|
||||||
to_write = xy_strcat (3, "Server = ", source.url, "/$repo/os/$arch");
|
to_write = xy_strcat (3, "Server = ", source.url, "/$repo/os/$arch\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
is_x86 = false;
|
is_x86 = false;
|
||||||
to_write = xy_strcat (3, "Server = ", source.url, "arm/$arch/$repo");
|
to_write = xy_strcat (3, "Server = ", source.url, "arm/$arch/$repo\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 配置文件中,越前面的优先级越高 */
|
/* 配置文件中,越前面的优先级越高 */
|
||||||
|
|
@ -124,8 +124,8 @@ os_archlinuxcn_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@happy-game", "@Young-Lord");
|
chef_set_sauciers (this, 2, "@happy-game", "@Young-Lord");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this,
|
chef_set_note (this,
|
||||||
"可额外使用 chsrc set arch 来更换 Arch Linux 源",
|
"可额外使用 chsrc set arch 来更换 Arch Linux 源",
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ os_msys2_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@ccmywish", "@hezonglun");
|
chef_set_sauciers (this, 2, "@ccmywish", "@hezonglun");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://mirror.msys2.org/", DelegateToUpstream},
|
{&UpstreamProvider, "https://mirror.msys2.org/", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ os_manjaro_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, NULL, DelegateToUpstream}
|
{&UpstreamProvider, NULL, DelegateToUpstream}
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,10 @@ void
|
||||||
chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support");
|
chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support");
|
||||||
|
|
||||||
// chef_allow_english(this); // 项目是否支持英文
|
// chef_allow_english(this); // 项目是否支持英文
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
|
|
||||||
// chef_allow_user_define(this); // 是否支持用户自定义镜像源
|
// chef_allow_user_define(this); // 是否支持用户自定义镜像源
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note ("中文备注说明...", "English note...");
|
chef_set_note ("中文备注说明...", "English note...");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ wr_anaconda_prelude ()
|
||||||
chef_set_sauciers (this, 2, "@Yangmoooo", "@xyx1926885268");
|
chef_set_sauciers (this, 2, "@Yangmoooo", "@xyx1926885268");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://repo.anaconda.com", DelegateToUpstream},
|
{&UpstreamProvider, "https://repo.anaconda.com", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ wr_cocoapods_prelude ()
|
||||||
|
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ wr_docker_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ wr_emacs_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this, "Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档",
|
chef_set_note (this, "Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档",
|
||||||
"Emacs users typically only need to switch sources once and rarely call chsrc, so we only provide documentation to users");
|
"Emacs users typically only need to switch sources once and rarely call chsrc, so we only provide documentation to users");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ wr_flatpak_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@jialinlvcn");
|
chef_set_sauciers (this, 1, "@jialinlvcn");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this, "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue",
|
chef_set_note (this, "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue",
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ wr_guix_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this, "目前只有一个源, guixcn 的源不知道是否可用",
|
chef_set_note (this, "目前只有一个源, guixcn 的源不知道是否可用",
|
||||||
"Currently only one source available, guixcn source availability unknown");
|
"Currently only one source available, guixcn source availability unknown");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ wr_homebrew_prelude ()
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_allow_english(this);
|
chef_allow_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
chef_set_note (this, "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件",
|
chef_set_note (this, "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件",
|
||||||
"This source switching is implemented by writing environment variables. If switching sources multiple times, please manually clean the profile file");
|
"This source switching is implemented by writing environment variables. If switching sources multiple times, please manually clean the profile file");
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ wr_nix_prelude ()
|
||||||
chef_set_sauciers (this, 0);
|
chef_set_sauciers (this, 0);
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_forbid_user_define(this);
|
chef_deny_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
{&UpstreamProvider, "https://channels.nixos.org/", DelegateToUpstream},
|
{&UpstreamProvider, "https://channels.nixos.org/", DelegateToUpstream},
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ wr_tex_prelude ()
|
||||||
chef_set_sauciers (this, 1, "@Mikachu2333");
|
chef_set_sauciers (this, 1, "@Mikachu2333");
|
||||||
|
|
||||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ wr_winget_prelude ()
|
||||||
chef_set_cooks (this, 1, "@ccmywish");
|
chef_set_cooks (this, 1, "@ccmywish");
|
||||||
chef_set_sauciers (this, 1, "@Mikachu2333");
|
chef_set_sauciers (this, 1, "@Mikachu2333");
|
||||||
|
|
||||||
chef_forbid_english(this);
|
chef_deny_english(this);
|
||||||
chef_allow_user_define(this);
|
chef_allow_user_define(this);
|
||||||
|
|
||||||
def_sources_begin()
|
def_sources_begin()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// chsrc.rc - Windows Resource Script
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "../framework/version.h"
|
||||||
|
|
||||||
|
// 图标资源
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "logo.ico"
|
||||||
|
|
||||||
|
// 版本信息
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION Chsrc_Version_Major,Chsrc_Version_Minor,Chsrc_Version_Patch,Chsrc_Version_Pre
|
||||||
|
// 经实验,该值会被下面的 ProductVersion 替换
|
||||||
|
// PRODUCTVERSION Chsrc_Version_Major,Chsrc_Version_Minor,Chsrc_Version_Patch,Chsrc_Version_Pre
|
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS VS_FF_DEBUG
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS VOS_NT_WINDOWS32
|
||||||
|
FILETYPE VFT_APP
|
||||||
|
FILESUBTYPE VFT2_UNKNOWN
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "RubyMetric"
|
||||||
|
VALUE "FileDescription", "Change Source everywhere for every software"
|
||||||
|
|
||||||
|
// 经实验,该值会被上面的 FILEVERSION 替换
|
||||||
|
// VALUE "FileVersion", Chsrc_Version
|
||||||
|
|
||||||
|
VALUE "InternalName", "chsrc"
|
||||||
|
VALUE "LegalCopyright", "Copyright (c) 2023-2025 RubyMetric"
|
||||||
|
VALUE "OriginalFilename", "chsrc.exe"
|
||||||
|
VALUE "ProductName", "chsrc"
|
||||||
|
VALUE "ProductVersion", Chsrc_Version
|
||||||
|
VALUE "Comments", "Released on " Chsrc_Release_Date " (GPLv3+)"
|
||||||
|
VALUE "LegalTrademarks", "RubyMetric"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0804, 1200, 0x0409, 1200 // 简体中文和英语
|
||||||
|
END
|
||||||
|
END
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
19
test/cli.pl
19
test/cli.pl
|
|
@ -2,11 +2,11 @@
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# Test File : cli.pl
|
# Test File : cli.pl
|
||||||
# Test Authors : 曾奥然 <ccmywish@qq.com>
|
# Test Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
# Contributors : Nil Null <nil@null.org>
|
# Contributors : Nil Null <nil@null.org>
|
||||||
# Created On : <2024-06-05>
|
# Created On : <2024-06-05>
|
||||||
# Last Modified : <2025-09-27>
|
# Last Modified : <2025-10-29>
|
||||||
#
|
#
|
||||||
# 测试 chsrc 可执行文件
|
# 测试 chsrc 可执行文件
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
=encoding utf8
|
=encoding utf8
|
||||||
|
|
@ -62,11 +62,16 @@ use open qw(:std :encoding(UTF-8));
|
||||||
|
|
||||||
my $CHSRC = ($^O eq 'MSWin32') ? '.\chsrc' : './chsrc';
|
my $CHSRC = ($^O eq 'MSWin32') ? '.\chsrc' : './chsrc';
|
||||||
|
|
||||||
|
my $version_str_cn = qr|chsrc .*\n\nCopyright .*\n许可证 GPLv3\+:GNU GPL 第 3 版或更高版本|;
|
||||||
|
like `$CHSRC -v`, $version_str_cn, 'chsrc -v';
|
||||||
|
like `$CHSRC --version`, $version_str_cn, 'chsrc --version';
|
||||||
|
like `$CHSRC version`, $version_str_cn, 'chsrc version';
|
||||||
|
|
||||||
my $version_str = qr|chsrc .*\nCopyright .*\nLicense GPLv3\+: GNU GPL version 3 or later|;
|
my $version_str_en = qr|chsrc .*\n\nCopyright .*\nLicense GPLv3\+: GNU GPL version 3 or later|;
|
||||||
like `$CHSRC -v`, $version_str, 'chsrc -v';
|
like `$CHSRC -v -en`, $version_str_en, 'chsrc -v -en';
|
||||||
like `$CHSRC --version`, $version_str, 'chsrc --version';
|
like `$CHSRC -en -v`, $version_str_en, 'chsrc -en -v';
|
||||||
like `$CHSRC version`, $version_str, 'chsrc version';
|
like `$CHSRC --version -en`, $version_str_en, 'chsrc --version -en';
|
||||||
|
like `$CHSRC version -en`, $version_str_en, 'chsrc version -en';
|
||||||
|
|
||||||
my $help_str = qr/^ (help|list|get|set|reset)/m;
|
my $help_str = qr/^ (help|list|get|set|reset)/m;
|
||||||
like `$CHSRC -h`, $help_str, 'chsrc -h';
|
like `$CHSRC -h`, $help_str, 'chsrc -h';
|
||||||
|
|
|
||||||
12
test/fw.c
12
test/fw.c
|
|
@ -1,10 +1,10 @@
|
||||||
/** ------------------------------------------------------------
|
/** ------------------------------------------------------------
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
* File Authors : @ccmywish
|
||||||
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
* Contributors : @Mikachu2333
|
||||||
* Created On : <2024-12-14>
|
* Created On : <2024-12-14>
|
||||||
* Last Modified : <2025-10-06>
|
* Last Modified : <2025-12-29>
|
||||||
*
|
*
|
||||||
* 该文件最好启用 DEBUG mode 编译
|
* 该文件最好启用 DEBUG mode 编译
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
@ -85,10 +85,14 @@ main (int argc, char const *argv[])
|
||||||
|
|
||||||
if (xy.on_windows)
|
if (xy.on_windows)
|
||||||
{
|
{
|
||||||
chsrc_run_as_pwsh_file ("Write-Host \"Hello from PowerShell file\"");
|
chsrc_view_env ("OS", "windir", NULL);
|
||||||
|
chsrc_run_as_pwsh_file ("Write-Host \"Hello from PowerShell (v7) file\"");
|
||||||
|
chsrc_run_as_powershellv5_file ("Write-Host \"Hello from PowerShell v5 file\"");
|
||||||
|
chsrc_run_as_powershell_file ("Write-Host \"Hello from PowerShell file\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
chsrc_view_env ("PWD", NULL);
|
||||||
chsrc_run_as_sh_file ("echo Hello from sh file");
|
chsrc_run_as_sh_file ("echo Hello from sh file");
|
||||||
chsrc_run_as_bash_file ("echo Hello from Bash file");
|
chsrc_run_as_bash_file ("echo Hello from Bash file");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
! -------------------------------------------------------------
|
! -------------------------------------------------------------
|
||||||
! Doc Type : Markdown
|
! Doc Type : Markdown
|
||||||
! Doc Name : (Tools Introduction).md
|
! Doc Name : (Tools Introduction).md
|
||||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
! | xuan <wick.dynex@qq.com>
|
! | xuan <wick.dynex@qq.com>
|
||||||
! Contributors : ChatGPT <https://chatgpt.com>
|
! Contributors : ChatGPT <https://chatgpt.com>
|
||||||
! |
|
! |
|
||||||
! Created On : <2024-10-25>
|
! Created On : <2024-10-25>
|
||||||
! Last Modified : <2025-07-21>
|
! Last Modified : <2025-07-21>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue