Skip to content

Feature Request: Non-interactive mode for search-content command #75

@oichtental

Description

@oichtental

Problem

The search-content command currently requires an interactive terminal because it uses a fuzzy finder UI (go-fuzzyfinder) for result selection. When run non-interactively (in scripts, CI/CD, or piped commands), it fails with:

Cannot find note in vault

This makes it impossible to use search-content in automation workflows or to simply list matching results without user interaction.

Proposed Solution

Add a --list or --no-interactive flag that outputs matching results to stdout instead of launching the fuzzy finder:

# Current behavior (interactive only)
obsidian-cli search-content "query"

# Proposed: List mode
obsidian-cli search-content "query" --list
# Output:
# Documentation/Architecture/Backend Development Guidelines.md:8: ## Purpose
# Projects/Notes/meeting.md:15: The purpose of this meeting...

# Could also support different output formats
obsidian-cli search-content "query" --list --format json

Use Cases

  1. Scripting: Find notes matching criteria for batch processing
  2. Integration: Pipe results to other tools (grep, fzf, rofi, dmenu)
  3. Automation: Use in CI/CD or cron jobs
  4. Accessibility: Users who prefer their own fuzzy finder or selection method

Current Workaround

Users must fall back to raw grep:

grep -rn "query" "/path/to/vault" --include="*.md"

This bypasses the CLI entirely and loses integration with vault configuration.

Additional Context

  • The underlying SearchNotesWithSnippets() function already returns structured results
  • Only the presentation layer (fuzzy finder) requires interactivity
  • Similar CLIs like ripgrep and fzf support both interactive and non-interactive modes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions