1 Star 0 Fork 32

chris/kylin-code

forked from openKylin/kylin-code 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
close_telemetry.sh 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
chris 提交于 2024-03-14 09:12 +08:00 . build:更正脚本名称.
#!/usr/bin/env bash
# shellcheck disable=SC1091,SC2016
set -ex
# list of urls to match:
# - mobile.events.data.microsoft.com
# - vortex.data.microsoft.com
SEARCH="\.data\.microsoft\.com"
REPLACEMENT="s|//[^/]+\.data\.microsoft\.com|//0\.0\.0\.0|g"
exists() { type -t "$1" &> /dev/null; }
is_gnu_sed () {
sed --version &> /dev/null
}
replace () {
echo "${1}"
if is_gnu_sed; then
sed -i -E "${1}" "${2}"
else
sed -i '' -E "${1}" "${2}"
fi
}
if ! exists gsed; then
if is_gnu_sed; then
function gsed() {
sed -i -E "$@"
}
else
function gsed() {
sed -i '' -E "$@"
}
fi
fi
if is_gnu_sed; then
replace_with_debug () {
echo "found: ${2}"
sed -i -E "${1}" "${2}"
}
else
replace_with_debug () {
echo "found: ${2}"
sed -i '' -E "${1}" "${2}"
}
fi
export -f replace_with_debug
d1=$( date +%s )
arch=$(uname -m)
if [[ ${arch} == "x86_64" ]]; then
./node_modules/@vscode/ripgrep/bin/rg --no-ignore -l "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
else
grep -rl --exclude-dir=.git -E "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
fi
d2=$( date +%s )
echo "close_telemetry: $((d2 - d1))s"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chriswang521/kylin-code.git
git@gitee.com:chriswang521/kylin-code.git
chriswang521
kylin-code
kylin-code
master

搜索帮助