{"id":29586846,"url":"https://github.com/abgox/scoop-tools","last_synced_at":"2025-07-20T03:31:39.134Z","repository":{"id":295987202,"uuid":"991841507","full_name":"abgox/scoop-tools","owner":"abgox","description":"一个 Scoop 脚本，用于下载软件包时使用替换后的 url。A Scoop script that uses the replaced url  during the installation.","archived":false,"fork":false,"pushed_at":"2025-07-05T13:27:17.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-05T14:40:55.430Z","etag":null,"topics":["install","scoop","script"],"latest_commit_sha":null,"homepage":"https://gitee.com/abgox/scoop-tools","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abgox.png","metadata":{"files":{"readme":"readme-cn.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"abgox","patreon":null,"open_collective":null,"ko_fi":"abgox","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":["https://support-me.abgox.com/"]}},"created_at":"2025-05-28T08:22:36.000Z","updated_at":"2025-07-05T13:27:12.000Z","dependencies_parsed_at":"2025-05-28T12:32:51.174Z","dependency_job_id":"243f2d96-4b0d-4751-a45b-8b342b37e80c","html_url":"https://github.com/abgox/scoop-tools","commit_stats":null,"previous_names":["abgox/scoop-install","abgox/scoop-tools"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/abgox/scoop-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abgox%2Fscoop-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abgox%2Fscoop-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abgox%2Fscoop-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abgox%2Fscoop-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abgox","download_url":"https://codeload.github.com/abgox/scoop-tools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abgox%2Fscoop-tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266063102,"owners_count":23870719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["install","scoop","script"],"created_at":"2025-07-20T03:31:38.534Z","updated_at":"2025-07-20T03:31:39.081Z","avatar_url":"https://github.com/abgox.png","language":"PowerShell","funding_links":["https://github.com/sponsors/abgox","https://ko-fi.com/abgox","https://support-me.abgox.com/"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e✨scoop-tools✨\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"readme-cn.md\"\u003e简体中文\u003c/a\u003e |\n    \u003ca href=\"readme.md\"\u003eEnglish\u003c/a\u003e |\n    \u003ca href=\"https://github.com/abgox/scoop-tools\"\u003eGithub\u003c/a\u003e |\n    \u003ca href=\"https://gitee.com/abgox/scoop-tools\"\u003eGitee\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/abgox/scoop-tools/blob/main/license\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/abgox/scoop-tools\" alt=\"license\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/abgox/scoop-tools\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/v/release/abgox/scoop-tools?label=version\" alt=\"version\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://img.shields.io/github/languages/code-size/abgox/scoop-tools.svg\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/languages/code-size/abgox/scoop-tools.svg\" alt=\"code size\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://img.shields.io/github/repo-size/abgox/scoop-tools.svg\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/repo-size/abgox/scoop-tools.svg\" alt=\"repo size\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/abgox/scoop-tools\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/created-at/abgox/scoop-tools\" alt=\"created\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003e [!Tip]\n\u003e\n\u003e 推荐使用 [PSCompletions 中的 scoop/scoop-install/scoop-update 命令补全](https://gitee.com/abgox/PSCompletions)\n\n## 介绍\n\n- 一些 PowerShell 脚本，它允许你添加 Scoop 配置，在 Scoop 安装和更新应用时使用替换后的 url 而不是原始的 url\n  - `scoop-install`\n  - `scoop-update`\n- 典型的使用场景: 如果应用的安装包来自 [Github](https://github.com)，可以配置代理地址，优化中国境内的下载体验\n\n## 安装\n\n- 添加 bucket\n\n  ```powershell\n  scoop bucket add abyss https://gitee.com/abgox/abyss\n  ```\n\n- 安装 scoop-install\n\n  ```powershell\n  scoop install abyss/abgox.scoop-install\n  ```\n\n- 安装 scoop-update\n\n  ```powershell\n  scoop install abyss/abgox.scoop-update\n  ```\n\n## 使用\n\n\u003e [!Tip]\n\u003e Scoop 配置项\n\u003e\n\u003e - `scoop-install-url-replace-from`: 需要被替换的 url，使用正则表达式，用 `^` 限制匹配行首\n\u003e - `scoop-install-url-replace-to`: 用于替换的 url，必须和 `scoop-install-url-replace-from` 相对应\n\n1. 设置 url 替换配置，如果有多个值，使用 `|||` 分割\n\n   ```powershell\n   scoop config scoop-install-url-replace-from \"^https://github.com|||^https://raw.githubusercontent.com\"\n   scoop config scoop-install-url-replace-to \"https://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com\"\n   ```\n\n2. 使用 [PSCompletions](https://gitee.com/abgox/PSCompletions) 添加命令补全\n\n   ```powershell\n   scoop install abyss/abgox.pscompletions\n   ```\n\n   ```powershell\n   Import-Module PSCompletions\n   ```\n\n   ```powershell\n   psc add scoop-install scoop-update\n   ```\n\n3. 使用 `scoop-install` 命令安装应用\n\n   ```powershell\n   scoop-install abyss/Microsoft.PowerShell\n   ```\n\n4. 使用 `scoop-update` 命令更新应用\n\n   ```powershell\n   scoop-update abyss/Microsoft.PowerShell\n   ```\n\n---\n\n- `scoop-install` 可以使用 `-reset` 参数和 `scoop install` 命令的所有参数\n- `scoop-update` 可以使用 `-reset` 参数和 `scoop update` 命令的所有参数\n\n- 参考示例:\n\n  - 如果你想撤销所有 bucket 中的本地文件更改，避免 `scoop update` 出现远程同步冲突\n\n    - 它使用 `git stash` 实现\n    - 如果你还需要这些更改，可以使用 `git stash pop`，详情参考 [git stash](https://git-scm.com/docs/git-stash)\n\n    ```powershell\n    scoop-install -reset\n    ```\n\n  - 如果你想在安装 `abyss/Microsoft.PowerShell` 时不更新 Scoop，可以使用 `-u` 或 `--no-update-scoop`\n\n    ```powershell\n    scoop-install abyss/Microsoft.PowerShell -u\n    ```\n\n  - 如果你还不想使用下载缓存，可以使用 `-k` 或 `--no-cache`\n    ```powershell\n    scoop-install abyss/Microsoft.PowerShell -u --no-cache\n    ```\n\n## 实现原理\n\n\u003e [!Tip]\n\u003e\n\u003e 当你运行 `scoop-install abyss/Microsoft.PowerShell` 时，scoop-install 会执行以下逻辑\n\n1. scoop-install 会读取以下两个配置项的值\n\n   - `scoop-install-url-replace-from`\n   - `scoop-install-url-replace-to`\n\n2. scoop-install 会根据配置项的值替换 `abyss/Microsoft.PowerShell` 的清单文件中的 url\n\n   - 假如你使用了以下配置\n\n     - `scoop-install-url-replace-from` 的值为 `^https://github.com|||^https://raw.githubusercontent.com`\n     - `scoop-install-url-replace-to` 的值为 `https://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com`\n\n   - 它会根据 `|||` 进行分割，然后分别对 url 进行替换\n\n     - `^https://github.com` 匹配 `https://github.com` 开头的 url，然后替换为 `https://gh-proxy.com/github.com`\n     - `^https://raw.githubusercontent.com` 匹配 `https://raw.githubusercontent.com` 开头的 url，然后替换为 `https://gh-proxy.com/raw.githubusercontent.com`\n\n3. 替换完成后，scoop-install 才会执行实际的 `scoop install` 命令\n\n   - 由于清单中的 url 已经替换为了 `https://gh-proxy.com`\n   - 所以 Scoop 会从 `https://gh-proxy.com` 下载安装包\n\n4. 当安装完成或使用 `Ctrl + C` 终止安装后，scoop-install 会自动撤销 `abyss/Microsoft.PowerShell` 的清单文件中的本地更改\n\n   - 如果安装过程中，直接关掉终端，scoop-install 无法继续撤销本地更改\n   - 这可能导致因为本地残留的更改，`scoop update` 无法正常的同步远程 bucket 仓库\n   - 此时，你需要运行 `scoop-install -reset`，它会撤销所有 bucket 中的本地文件更改\n     - 它使用 `git stash` 实现\n     - 如果你还需要这些更改，可以使用 `git stash pop`，详情参考 [git stash](https://git-scm.com/docs/git-stash)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabgox%2Fscoop-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabgox%2Fscoop-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabgox%2Fscoop-tools/lists"}