简体中文 | English | Github | Gitee
Tip
scoop/scoop-install/scoop-update completion in PSCompletions is recommended.
- Some PowerShell scripts that allows you to add Scoop configurations to use a replaced url instead of the original url when installing the app in Scoop.
scoop-install
scoop-update
- Typical case: if app come from GitHub, you can configure a proxy URL to improve download experience in China.
-
Add bucket
scoop bucket add abyss https://gitee.com/abgox/abyss
-
Install scoop-install
scoop install abyss/abgox.scoop-install
-
Install scoop-update
scoop install abyss/abgox.scoop-update
Tip
Scoop Config
scoop-install-url-replace-from
: The URL to replace, use regular expressions. Use^
to match the beginning of the URL.scoop-install-url-replace-to
: The replacement URL that corresponds toscoop-install-url-replace-from
.
-
Set URL replacement configurations. Use
|||
as a delimiter if there are multiple values.scoop config scoop-install-url-replace-from "^https://github.com|||^https://raw.githubusercontent.com" scoop config scoop-install-url-replace-to "https://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com"
-
Install PSCompletions to add command completion.
scoop install abyss/abgox.pscompletions
Import-Module PSCompletions
psc add scoop-install scoop-update
-
Install apps using the
scoop-install
command.scoop-install abyss/Microsoft.PowerShell
-
Update apps using the
scoop-update
command.scoop-update abyss/Microsoft.PowerShell
-
scoop-install
supports the-reset
parameter and all parameters of thescoop install
command. -
scoop-update
supports the-reset
parameter and all parameters of thescoop update
command. -
Examples:
-
If you want to undo all local file changes in the buckets to avoid synchronization conflicts during
scoop update
.- It uses
git stash
to undo. - If you still need these changes, you can use
git stash pop
. For details, refer to git stash
scoop-install -reset
- It uses
-
If you want to install
abyss/abgox.InputTip-zip
without updating Scoop, you can use-u
or--no-update-scoop
.scoop-install abyss/Microsoft.PowerShell -u
-
If you don't also want to use the download cache, you can use
-k
or--no-cache
.scoop-install abyss/Microsoft.PowerShell -u --no-cache
-
Tip
When you run scoop-install abyss/Microsoft.PowerShell
, it goes through the following process:
-
scoop-install
reads the following two configuration values:scoop-install-url-replace-from
scoop-install-url-replace-to
-
It replaces
url
in the manifest file ofabyss/Microsoft.PowerShell
based on these configurations.-
For example, if you use the following configuration:
scoop-install-url-replace-from
is set to^https://github.com|||^https://raw.githubusercontent.com
scoop-install-url-replace-to
is set tohttps://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com
-
It will split the values by
|||
and replace theurl
accordingly:^https://github.com
matchesurl
starting withhttps://github.com
and replaces them withhttps://gh-proxy.com/github.com
.^https://raw.githubusercontent.com
is replaced withhttps://gh-proxy.com/raw.githubusercontent.com
.
-
-
After replacement,
scoop-install
runs the actualscoop install
command.- Since
url
of the manifest have been replaced withhttps://gh-proxy.com
, Scoop will download the installation packages fromhttps://gh-proxy.com
.
- Since
-
Once the installation is complete (or interrupted with
Ctrl + C
),scoop-install
automatically undos the changes made to the manifest file.-
If you close the terminal during installation, it cannot undo the changes.
-
This may cause issues with
scoop update
due to local file modifications conflicting with the remote bucket. -
In that case, you can run
scoop-install -reset
, which will undo local file changes in all buckets viagit stash
.- It uses
git stash
to undo. - If you still need these changes, you can use
git stash pop
. For details, refer to git stash
- It uses
-