Skip to content

search tags#80

Open
Sean-Shmulevich wants to merge 1 commit intoYakitrak:mainfrom
Sean-Shmulevich:main
Open

search tags#80
Sean-Shmulevich wants to merge 1 commit intoYakitrak:mainfrom
Sean-Shmulevich:main

Conversation

@Sean-Shmulevich
Copy link

@Sean-Shmulevich Sean-Shmulevich commented Feb 8, 2026

New command: search (alias: s)
obsidian-cli search [tag] [options]

Output formats (--format, -f):
names - Just filenames (deduplicated)
locations - Filename:line_number (default)
lines - Full line content with context
blocks - Paragraph/block until empty line

Features:

  • Support inline #tags and frontmatter tags
  • Support nested tags (programming/philosophy, programming/a/b/c)
  • Support hyphens and underscores (learning-strategy, dist_sys)
  • --subtags (-s): include child tags when searching parent
  • --location (-l): filter by frontmatter/inline/all
  • --context (-c): lines around match (for lines/blocks format)
  • --editor (-e): open in editor

Block vs Line distinction:

  • Line: single line ending with newline
  • Block: contiguous text until empty line (paragraph)

Robustness:

  • Excludes markdown headers, hex codes, code blocks
  • Excludes numeric-only tags
  • Comprehensive test coverage (27+ tests)

Examples:
obsidian-cli search programming obsidian-cli search programming -f names -s obsidian-cli search daily -f blocks -c 2 obsidian-cli search work -s -l frontmatter

Pull Request Title

Description

Motivation and Context

Checklist:

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

New command: search (alias: s)
  obsidian-cli search [tag] [options]

Output formats (--format, -f):
  names      - Just filenames (deduplicated)
  locations  - Filename:line_number (default)
  lines      - Full line content with context
  blocks     - Paragraph/block until empty line

Features:
- Support inline #tags and frontmatter tags
- Support nested tags (programming/philosophy, programming/a/b/c)
- Support hyphens and underscores (learning-strategy, dist_sys)
- --subtags (-s): include child tags when searching parent
- --location (-l): filter by frontmatter/inline/all
- --context (-c): lines around match (for lines/blocks format)
- --editor (-e): open in editor

Block vs Line distinction:
- Line: single line ending with newline
- Block: contiguous text until empty line (paragraph)

Robustness:
- Excludes markdown headers, hex codes, code blocks
- Excludes numeric-only tags
- Comprehensive test coverage (27+ tests)

Examples:
  obsidian-cli search programming
  obsidian-cli search programming -f names -s
  obsidian-cli search daily -f blocks -c 2
  obsidian-cli search work -s -l frontmatter
@Sean-Shmulevich Sean-Shmulevich changed the title Add unified tag search command with multiple output formats ``` **Method 2 - Manual:** 1. Go to: https://github.com/Yakitrak/obsidian-cli 2. Click **"Pull requests"** tab 3. Click **"New pull request"** (green button) 4. Click **"compare across forks"** 5. **base repository:** Yakitrak/obsidian-cli 6. **base:** main 7. **head repository:** Sean-Shmulevich/obsidian-cli search tags Feb 8, 2026
@Yakitrak
Copy link
Owner

Thank you for the PR, I will take a look soon!

@Yakitrak
Copy link
Owner

Hey are your changes to completely remove the existing search functionality intentional? Happy to add a tag command but I don't want to remove existing functionality. There are also conflicts, can you please take a look @Sean-Shmulevich?

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.

2 participants

Comments