Skip to content

add list command to display vault contents#73

Merged
Yakitrak merged 4 commits into
Yakitrak:mainfrom
satputekuldip:#72-list-tool
Jan 31, 2026
Merged

add list command to display vault contents#73
Yakitrak merged 4 commits into
Yakitrak:mainfrom
satputekuldip:#72-list-tool

Conversation

@satputekuldip

@satputekuldip satputekuldip commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

Add list command to display vault contents

Add vault listing command

Description

  • Implemented list command to list files and folders in a vault.
  • Added ListEntries action for vault-relative directory listing.
  • Added unit tests for ListEntries.
  • Updated README with usage examples for list.

Motivation and Context
Users need to discover vault structure without relying on filesystem commands or absolute paths. This adds a native CLI command to list vault contents at the root or a subfolder.

Checklist:

  • I have written unit tests for my changes.
  • I have updated the documentation accordingly.
  • All new and existing tests passed. (not run)

- Implemented `list` command to list files and folders in a vault.
- Updated README with usage examples for the new command.
- Added tests for `ListEntries` function to ensure correct functionality.
@Yakitrak

Yakitrak commented Jan 31, 2026

Copy link
Copy Markdown
Owner

Thank you for contributing! The functionality itself looks good on a brief review but I can see some improvements e.g.

  • The functionality is not separated into pkg/Obsidian - this is cleaner than having everything be on the actions/list.go file. Look at https://github.com/Yakitrak/obsidian-cli/blob/main/pkg/actions/move.go for an example
  • Please can you add a screenshot (or multiple) to the pull request to illustrate the outputs.
  • Also please update the image on README.md for the new command - there is a command to automate this in the Makefile

@Yakitrak Yakitrak self-requested a review January 31, 2026 11:49
@satputekuldip

Copy link
Copy Markdown
Contributor Author

Sure... On it...

- Simplified ListEntries by delegating to obsidian.ListEntries.
- Removed unnecessary error handling and directory checks.
- Added new list.go file to encapsulate list-related functionality.
- Updated documentation images for usage and output.
@satputekuldip

Copy link
Copy Markdown
Contributor Author

on root dir
Screenshot 2026-01-31 at 5 26 16 PM

some more examples

Screenshot 2026-01-31 at 5 27 34 PM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a list command to enable users to browse vault contents through the CLI without relying on external filesystem tools. The implementation follows established patterns in the codebase for command structure, error handling, and action delegation.

Changes:

  • Implemented ListEntries function in the obsidian package to read and filter directory contents
  • Added ListEntries action wrapper following the VaultManager interface pattern
  • Created list CLI command with ls alias supporting optional path argument and vault flag

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/obsidian/list.go Core listing logic with path validation, hidden file filtering, and alphabetical sorting
pkg/actions/list.go Action layer wrapper connecting vault manager to obsidian package
pkg/actions/list_test.go Comprehensive test suite for the actions layer covering various scenarios
cmd/list.go CLI command implementation with argument parsing and output formatting
README.md Documentation update adding list command to capabilities and usage examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/obsidian/list.go
- Verify sorting of directories and files.
- Ensure hidden files and folders are filtered out.
- Check that empty directories return an empty list.
- Validate error handling for non-directory paths.
- Reject path traversal attempts.
@Yakitrak

Copy link
Copy Markdown
Owner

Thanks! Just one last thing, the usage.png image looks like its formatted wrong:
image

No worries if you can't fix it, feel free to revert that change and I can do it after merge.

@satputekuldip

Copy link
Copy Markdown
Contributor Author

Can you provide guideline how to do it... I tried multiple times still same results...

@Yakitrak

Copy link
Copy Markdown
Owner

I just use the make update-usage-image and it does it perfectly for me. No worries, feel free to revert your change on the image and we can merge it.

- Replace the existing usage.png with an updated version.
- Ensure the image reflects the latest features and commands.

@Yakitrak Yakitrak left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for contributing! I will do a release soon in the next week or so (with another change I might work on).

@Yakitrak Yakitrak merged commit f6d1fcb into Yakitrak:main Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants