cn commands: use omarchy-cmd helpers per bin style rule
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
@@ -30,7 +30,7 @@ codex) agent="codex" ;;
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
command=$(cn_ai_harness_field "$harness" command)
|
command=$(cn_ai_harness_field "$harness" command)
|
||||||
if ! command -v "$command" > /dev/null 2>&1; then
|
if omarchy-cmd-missing "$command"; then
|
||||||
install=$(cn_ai_harness_field "$harness" install)
|
install=$(cn_ai_harness_field "$harness" install)
|
||||||
echo "Installing $harness: $install"
|
echo "Installing $harness: $install"
|
||||||
$install
|
$install
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ provider=$(cn_ai_profile_field "$profile" provider)
|
|||||||
command=$(cn_ai_harness_field "$harness" command)
|
command=$(cn_ai_harness_field "$harness" command)
|
||||||
proto=$(cn_ai_harness_field "$harness" protocol)
|
proto=$(cn_ai_harness_field "$harness" protocol)
|
||||||
|
|
||||||
if command -v "$command" > /dev/null 2>&1; then
|
if omarchy-cmd-present "$command"; then
|
||||||
echo "PASS ai: harness $harness installed ($command)"
|
echo "PASS ai: harness $harness installed ($command)"
|
||||||
else
|
else
|
||||||
install=$(cn_ai_harness_field "$harness" install)
|
install=$(cn_ai_harness_field "$harness" install)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ model=$(cn_ai_profile_field "$profile" model)
|
|||||||
command=$(cn_ai_harness_field "$harness" command)
|
command=$(cn_ai_harness_field "$harness" command)
|
||||||
config_method=$(cn_ai_harness_field "$harness" config_method)
|
config_method=$(cn_ai_harness_field "$harness" config_method)
|
||||||
|
|
||||||
if ! command -v "$command" > /dev/null 2>&1; then
|
if omarchy-cmd-missing "$command"; then
|
||||||
install=$(cn_ai_harness_field "$harness" install)
|
install=$(cn_ai_harness_field "$harness" install)
|
||||||
if [[ $install == doc:* ]]; then
|
if [[ $install == doc:* ]]; then
|
||||||
echo "$harness 未安装,安装方法见官方文档: ${install#doc:}" >&2
|
echo "$harness 未安装,安装方法见官方文档: ${install#doc:}" >&2
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ FILE_DIR="$HOME/.local/state/omarchycn/secrets"
|
|||||||
FILE_PATH="$FILE_DIR/$provider"
|
FILE_PATH="$FILE_DIR/$provider"
|
||||||
|
|
||||||
secret_service_ok() {
|
secret_service_ok() {
|
||||||
command -v secret-tool > /dev/null 2>&1 && secret-tool search service omarchycn > /dev/null 2>&1
|
omarchy-cmd-present secret-tool && secret-tool search service omarchycn > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
pass_ok() {
|
pass_ok() {
|
||||||
command -v pass > /dev/null 2>&1 && pass ls > /dev/null 2>&1
|
omarchy-cmd-present pass && pass ls > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
@@ -87,7 +87,7 @@ rm)
|
|||||||
rm -f "$FILE_PATH"
|
rm -f "$FILE_PATH"
|
||||||
removed=1
|
removed=1
|
||||||
fi
|
fi
|
||||||
if command -v secret-tool > /dev/null 2>&1 && ! secret_service_ok; then
|
if omarchy-cmd-present secret-tool && ! secret_service_ok; then
|
||||||
echo "Secret Service 不可达,无法确认其中的副本已清除;服务恢复后重新执行 rm" >&2
|
echo "Secret Service 不可达,无法确认其中的副本已清除;服务恢复后重新执行 rm" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user