9 Star 58 Fork 4

RubyMetric / chsrc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
chsrc logo

全平台命令行换源工具,目标支持 Linux (包括麒麟、openEuler、deepin等), Windows, macOS, BSD 等尽可能多的操作系统,龙芯、飞腾、RISC-V 等尽可能多的CPU

我们使用 C99 来完成上述目标。我们并不使用Python或JS等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百MB其他文件。

本软件为自由软件,采用 GPLv3 和 MIT 双许可证。


示例

chsrc logo

安装

以下方式均下载到当前目录,可直接通过 ./chsrc 运行。

Windows

# x64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-x64-windows.exe -o chsrc.exe

# x86
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-x86-windows.exe -o chsrc.exe

Linux

# x64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-x64-linux -o chsrc; chmod +x ./chsrc

# aarch64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-aarch64-linux -o chsrc; chmod +x ./chsrc

# riscv64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-riscv64-linux -o chsrc; chmod +x ./chsrc

# armv7
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-armv7-linux -o chsrc; chmod +x ./chsrc

macOS

# x64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/latest/chsrc-x64-macos -o chsrc; chmod +x ./chsrc

BSD

git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc
clang -Iinclude src/chsrc.c -o chsrc

其他平台

git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make

使用

使用:chsrc <command> [target]

help                    # 打印此帮助,或 h, -h, --help
list (ls, 或 l)      # 列出可用镜像源,和可换源软件
list mirror/target      # 列出可用镜像源,或可换源软件
list os/lang/ware       # 列出可换源的操作系统/编程语言/软件
list <target>           # 查看该软件可以使用哪些源

cesu <target>           # 对该软件所有源测速
get  <target>           # 查看当前软件的源使用情况

set  <target>           # 换源,自动测速后挑选最快源
set  <target> def(ault) # 换源,默认使用维护团队测速第一的源
set  <target> <mirror>  # 换源,指定使用某镜像站

当你不想自动测速的时候,你可以直接指定某镜像站。

chsrc set ruby           # 测速,寻找最快者,换源
# 或
chsrc ls  ruby           # 列出可用的镜像站
chsrc set ruby rubychina # 使用 RubyChina 作为镜像站

编程语言开发

chsrc set ruby    或 set gem
chsrc set python  或 set pip
chsrc set node    或 set npm / nodejs / yarn / pnpm # 同时换3个
chsrc set perl    或 set cpan
chsrc set php     或 set composer
chsrc set lua     或 set luarocks

chsrc set go
chsrc set rust    或 set cargo / crate
chsrc set java    或 set maven / mvn / gradle
chsrc set clojure 或 set clojars
chsrc set dart    或 set pub / flutter # 同时会为flutter换源
chsrc set haskell 或 set hackage/cabal/stack
chsrc set ocaml   或 set opam

# 同时会为 bioconductor 换源
chsrc set r       或 set cran
chsrc set julia

操作系统

sudo chsrc set ubuntu
sudo chsrc set mint  或 linuxmint
sudo chsrc set debian
sudo chsrc set fedora
sudo chsrc set suse  或 set opensuse
sudo chsrc set kali
sudo chsrc set arch  # 同时使用 archlinuxcn
sudo chsrc set manjaro
sudo chsrc set gentoo
sudo chsrc set rocky 或 set rockylinux
sudo chsrc set alpine
sudo chsrc set void  或 set voidlinux
sudo chsrc set solus
sudo chsrc set ros   或 set ros2
sudo chsrc set trisquel
sudo chsrc set lite  或 set linuxlite
sudo chsrc set raspi 或 set raspberrypi

sudo chsrc set deepin
sudo chsrc set euler  或 set openeuler
sudo chsrc set kylin  或 set openkylin

chsrc set msys2 或 set msys

# BSD
sudo chsrc set freebsd
sudo chsrc set openbsd
sudo chsrc set netbsd

软件

chsrc set brew   或 set homebrew
chsrc set flathub
chsrc set nix
chsrc set guix
chsrc set emacs  或 set elpa
chsrc set tex    或 set ctan / latex / texlive / miktex
chsrc set conda  或 set anaconda

开发

请安装好 gccclangmake 以及 curl

# 使用 dev 分支开发
git clone https://gitee.com/RubyMetric/chsrc.git -b dev

make          # 默认使用 cc 编译
make CC=clang # 使用 clang 编译
make CC=gcc   # 使用 gcc   编译

make test    # 测试部分命令
make test_xy # 测试 xy.h
make clean

致谢

感谢各个镜像站提供的优质免费镜像服务,使用的镜像站见 source.h.

另外感谢以下项目:

  1. MirrorZ 教育网镜像站
  2. 清华大学 Tuna
  3. Thanks Mirror项目 by @eryajf

许可证与版权 1. chsrc 主程序采用 GPLv3 许可证,保证该软件的永久自由。 2. xy.h 文件单独采用 MIT 许可证,保证该库可以在尽可能多的情况下复用。 使用 xy.h 全部或部分源代码,仅要求您在您的软件中包含此文件下方的 MIT 部分,以说明许可证和版权信息。 而使用 chsrc 的代码,则要求您履行 GPLv3 的所有条件。 --- GNU GENERAL PUBLIC LICENSE Version 3 (GPLv3) Copyright (c) 2023-present 曾奥然 (Aoran Zeng), 郭恒 (Heng Guo). All rights reserved. See: https://www.gnu.org/licenses/gpl-3.0.html --- MIT License Copyright (c) 2023-present 曾奥然 (Aoran Zeng), 郭恒 (Heng Guo). All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

chsrc 全平台命令行换源工具 展开 收起
C 等 3 种语言
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/RubyMetric/chsrc.git
git@gitee.com:RubyMetric/chsrc.git
RubyMetric
chsrc
chsrc
main

搜索帮助