feat: add list-vaults command and validate set-default input#98
Open
petems wants to merge 2 commits intoYakitrak:mainfrom
Open
feat: add list-vaults command and validate set-default input#98petems wants to merge 2 commits intoYakitrak:mainfrom
petems wants to merge 2 commits intoYakitrak:mainfrom
Conversation
- Add `list-vaults` (alias `lv`) command with --json and --path-only flags - Add ListVaults() function to enumerate all vaults from obsidian.json - Derive vault names from directory path using filepath.Base() - Apply WSL path adjustment when running under WSL - Sort output alphabetically by vault name for deterministic display - Add support for numbered snap subdirectories (e.g. ~/snap/obsidian/x1/) when the "current" symlink is missing - Add tests for vault listing (7 cases) and numbered snap discovery Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
set-default now resolves user input (name or path) against Obsidian's registered vaults, preventing silent failures when a path is passed instead of a vault name. Unrecognized input produces a helpful error listing available vaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Thank you for the PR, please can you update the README.md documentation similar to the rest of the commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list-vaults(aliaslv) command that discovers all registered Obsidian vaults from the config file, with--jsonand--path-onlyoutput flagsset-defaultinput against registered vaults via a newResolveVaultNamehelper — accepts vault name or full path, and shows available vaults on mismatch~/snap/obsidian/x1/...) when thecurrentsymlink is absentWhat's included
cmd/list_vaults.golist-vaultscommand with--jsonand--path-onlyflagscmd/set_default.goset-defaultthroughResolveVaultNamefor input validationpkg/obsidian/vault_list.goListVaults()andResolveVaultName()— vault discovery and name resolutionpkg/obsidian/vault_list_test.gopkg/config/obsidian_path.gopkg/config/obsidian_path_test.goReferences
list-vaultscommand to discover registered Obsidian vaults #97Test plan
go test ./...passes locallynotesmd list-vaultsshows registered vaultsnotesmd list-vaults --jsonoutputs valid JSON arraynotesmd list-vaults --path-onlyoutputs one path per linenotesmd set-default NonExistentprints available vaults and exits with errornotesmd set-default <valid-vault>succeeds as beforeAI disclosure
This PR was developed with assistance from Claude Code (claude-opus-4-6). The AI helped with code generation, test writing, and PR preparation. All code was reviewed and validated by a human before submission.
🤖 Generated with Claude Code