wiki-switch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWiki Switch — Manage Multiple Vault Profiles
Wiki Switch — 管理多个Vault配置文件
Each vault is a complete config file at . The active vault is
whichever file symlinks to. Switching vaults means re-pointing that symlink.
~/.obsidian-wiki/config.<name>~/.obsidian-wiki/config每个vault都是路径下的完整配置文件。当前激活的vault是符号链接指向的文件。切换vault意味着重新指向该符号链接。
~/.obsidian-wiki/config.<name>~/.obsidian-wiki/configDispatch
指令分发
Parse the invocation and route to the right section:
| Invocation | Action |
|---|---|
| → Switch |
| → List |
| → Show |
| → New |
| → List (treat as list) |
解析调用指令并路由到对应功能模块:
| 调用指令 | 操作 |
|---|---|
| → 切换 |
| → 列出 |
| → 查看 |
| → 新建 |
| → 列出(视为列出操作) |
Switch (default action)
切换(默认操作)
Activate a named vault profile.
- Verify exists. If not, tell the user the vault doesn't exist and list what's available (run List).
~/.obsidian-wiki/config.<name> - Run:
bash
ln -sf ~/.obsidian-wiki/config.<name> ~/.obsidian-wiki/config - Read from the newly active config.
OBSIDIAN_VAULT_PATH - Confirm to the user:
Switched to vault: <name> Vault path: <value of OBSIDIAN_VAULT_PATH from the config>
激活指定名称的vault配置文件。
- 验证是否存在。如果不存在,告知用户该vault不存在并列出可用的vault(执行列出操作)。
~/.obsidian-wiki/config.<name> - 运行以下命令:
bash
ln -sf ~/.obsidian-wiki/config.<name> ~/.obsidian-wiki/config - 从新激活的配置文件中读取。
OBSIDIAN_VAULT_PATH - 向用户确认:
已切换到vault: <name> Vault路径: <配置文件中OBSIDIAN_VAULT_PATH的值>
List
列出
Show all registered vault profiles and which is active.
- Find all files matching (exclude
~/.obsidian-wiki/config.*itself — that's the symlink).config - Resolve the current symlink target:
readlink ~/.obsidian-wiki/config - For each config file, read the first non-empty comment line (lines starting with ) as a human description of the vault. Fall back to the file's suffix as the label if no comment exists.
# - Display:
Mark the active one with
Vaults: personal My personal research wiki ← active work Work projects wiki. If the symlink is broken or← activedoesn't exist, showconfig.(none active)
显示所有已注册的vault配置文件以及当前激活的vault。
- 查找所有匹配的文件(排除
~/.obsidian-wiki/config.*本身——这是符号链接)。config - 获取当前符号链接的目标:
readlink ~/.obsidian-wiki/config - 对于每个配置文件,读取第一个非空注释行(以开头的行)作为vault的人工描述。如果没有注释行,则使用文件的后缀作为标签。
# - 显示格式如下:
用
Vault列表: personal 我的个人研究wiki ← 当前激活 work 工作项目wiki标记当前激活的vault。如果符号链接损坏或← 当前激活不存在,则显示config。(无激活vault)
Show
查看
Print the full config for a vault.
- If a name is given, read .
~/.obsidian-wiki/config.<name> - If no name given, read (the active vault).
~/.obsidian-wiki/config - If the file doesn't exist, tell the user and list what's available.
- Print the file contents verbatim (redact any lines containing or
API_KEY— showSECRETinstead of the value).***
打印vault的完整配置内容。
- 如果指定了名称,读取。
~/.obsidian-wiki/config.<name> - 如果未指定名称,读取(当前激活的vault)。
~/.obsidian-wiki/config - 如果文件不存在,告知用户并列出可用的vault。
- 逐字打印文件内容(对包含或
API_KEY的行进行脱敏处理——用SECRET替代对应值)。***
New
新建
Scaffold a new vault config from the current active config as a template.
- Check doesn't already exist. Abort if it does.
~/.obsidian-wiki/config.<name> - Copy the active config:
bash
cp ~/.obsidian-wiki/config ~/.obsidian-wiki/config.<name> - Read the copied config. Config files use comment headers to group fields into sections (e.g.,
# --- Section name ---,# --- Vault-specific ---,# --- Vault-independent ---). Use these sections to determine what to ask about:# --- Secrets ---- Fields in sections labeled "vault-specific", "paths", or similar → ask the user for new values
- Fields in sections labeled "vault-independent", "global", "shared" → keep as-is (copy over unchanged)
- Fields in sections labeled "secrets" → ask if the new vault uses the same credentials or different ones
- If there are no section headers, present all fields and let the user decide which to change
- Ask the user for updated values for the vault-specific fields. Use the current values as visible defaults — the user only needs to supply what differs.
- Write the updated values into .
~/.obsidian-wiki/config.<name> - Update the top comment line to describe the new vault (e.g., ).
# Obsidian Wiki — <name> vault - Confirm:
Do not switch automatically — let the user decide when to activate.
Created: ~/.obsidian-wiki/config.<name> Run `/wiki-switch <name>` to activate it.
以当前激活的配置文件为模板,生成新的vault配置文件。
- 检查是否已存在。如果存在则终止操作。
~/.obsidian-wiki/config.<name> - 复制当前激活的配置文件:
bash
cp ~/.obsidian-wiki/config ~/.obsidian-wiki/config.<name> - 读取复制后的配置文件。配置文件使用注释标题将字段分组为不同章节(例如
# --- 章节名称 ---、# --- Vault专属配置 ---、# --- Vault通用配置 ---)。根据这些章节决定需要询问用户的内容:# --- 机密信息 ---- 标记为“vault专属配置”、“路径”或类似名称的章节中的字段 → 询问用户新值
- 标记为“vault通用配置”、“全局”、“共享”的章节中的字段 → 保持原样(直接复制不变)
- 标记为“机密信息”的章节中的字段 → 询问用户新vault是否使用相同的凭据或不同的凭据
- 如果没有章节标题,则展示所有字段并让用户决定需要修改哪些
- 询问用户vault专属字段的更新值。将当前值设为可见默认值——用户只需提供与默认值不同的内容即可。
- 将更新后的值写入。
~/.obsidian-wiki/config.<name> - 更新顶部注释行以描述新vault(例如)。
# Obsidian Wiki — <name> vault - 向用户确认:
不要自动切换——让用户决定何时激活。
已创建: ~/.obsidian-wiki/config.<name> 运行`/wiki-switch <name>`以激活它。