Brucekomike(讨论 | 贡献) (创建页面,内容为“#!/bin/bash # Create proxy.sh cat << 'EOF' | sudo tee /usr/local/bin/proxy.sh > /dev/null #!/bin/bash export ProIP="http://127.0.0.1:2080" export http_proxy="$ProIP" export https_proxy="$ProIP" # Execute the command passed as arguments "$@" EOF # Make proxy.sh executable sudo chmod +x /usr/local/bin/proxy.sh # Add Zsh completion for proxy.sh mkdir -p ~/.zsh/completion cat << 'EOF' > ~/.zsh/completion/_proxy.sh #compdef proxy.sh _proxy_sh() { local wor…”) |
Brucekomike(讨论 | 贡献) 无编辑摘要 |
||
第22行: | 第22行: | ||
_proxy_sh() { | _proxy_sh() { | ||
local -a args | |||
args=( | |||
'*:: :_normal' | |||
) | |||
_arguments -s -S $args | |||
} | } | ||
2025年1月6日 (一) 03:03的最新版本
- !/bin/bash
- Create proxy.sh
cat << 'EOF' | sudo tee /usr/local/bin/proxy.sh > /dev/null
- !/bin/bash
export ProIP="http://127.0.0.1:2080" export http_proxy="$ProIP" export https_proxy="$ProIP"
- Execute the command passed as arguments
"$@" EOF
- Make proxy.sh executable
sudo chmod +x /usr/local/bin/proxy.sh
- Add Zsh completion for proxy.sh
mkdir -p ~/.zsh/completion
cat << 'EOF' > ~/.zsh/completion/_proxy.sh
- compdef proxy.sh
_proxy_sh() {
local -a args args=( '*:: :_normal' ) _arguments -s -S $args
}
_proxy_sh "$@" EOF
- Ensure the completion directory is sourced in .zshrc
if ! grep -q "fpath+=~/.zsh/completion" ~/.zshrc; then
echo "fpath+=(~/.zsh/completion)" >> ~/.zshrc echo "autoload -U compinit && compinit" >> ~/.zshrc
fi
echo "proxy.sh setup complete with Zsh completion."