Overlay: comments-only extension template counts as replaceable
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
@@ -27,8 +27,15 @@ valid_entry() {
|
|||||||
MENU_EXT="$HOME/.config/omarchy/extensions/omarchy-menu.jsonc"
|
MENU_EXT="$HOME/.config/omarchy/extensions/omarchy-menu.jsonc"
|
||||||
MENU_MARKER="// OmarchyCN overlay menu extension"
|
MENU_MARKER="// OmarchyCN overlay menu extension"
|
||||||
|
|
||||||
|
# Comments-only files (upstream ships such a template) hold no user content
|
||||||
|
menu_ext_has_user_content() {
|
||||||
|
[[ -f $MENU_EXT ]] || return 1
|
||||||
|
grep -qF "$MENU_MARKER" "$MENU_EXT" && return 1
|
||||||
|
[[ -n $(grep -vE '^[[:space:]]*(//.*)?$' "$MENU_EXT" | tr -d '[:space:]{}') ]]
|
||||||
|
}
|
||||||
|
|
||||||
install_menu_extension() {
|
install_menu_extension() {
|
||||||
if [[ -s $MENU_EXT ]] && ! grep -qF "$MENU_MARKER" "$MENU_EXT"; then
|
if menu_ext_has_user_content; then
|
||||||
echo "跳过菜单扩展:$MENU_EXT 已有用户内容,请手动合并 default/omarchy/omarchy-menu.jsonc 的 OmarchyCN 段"
|
echo "跳过菜单扩展:$MENU_EXT 已有用户内容,请手动合并 default/omarchy/omarchy-menu.jsonc 的 OmarchyCN 段"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user