build: Generate onyx.exe and associated PyInstaller build artifacts.
This commit is contained in:
1 parent
21837be512
commit
e536630b91
8 files changed
+80
-63
No files matched your search
+20
-3
@@ -469,7 +469,7 @@ class OnyxCLI:
|
||||
self._update_frontmatter(note_path, updates)
|
||||
click.echo(f"Updated frontmatter for {note_name}")
|
||||
|
||||
def frontmatter_view(self, note_name: str, key: str, value: str = None, vault: str = None):
|
||||
def frontmatter_view(self, note_name: str, key: str, value: str = None, vault: str = None, open_file: bool = False):
|
||||
vault_name, vault_path = self._get_vault_and_path(vault)
|
||||
note_path = vault_path / note_name
|
||||
if not note_path.suffix:
|
||||
@@ -490,6 +490,22 @@ class OnyxCLI:
|
||||
click.echo(f"Key '{key}' not found in frontmatter")
|
||||
return
|
||||
|
||||
if open_file:
|
||||
current_value = frontmatter[key]
|
||||
val_str = str(current_value)
|
||||
# Extract [[...]] if present
|
||||
match = re.search(r'\[\[(.*?)\]\]', val_str)
|
||||
if match:
|
||||
target_note = match.group(1)
|
||||
# Handle alias like [[Note Name|Alias]]
|
||||
if '|' in target_note:
|
||||
target_note = target_note.split('|')[0]
|
||||
else:
|
||||
target_note = val_str
|
||||
|
||||
self.open_note(target_note, vault=vault)
|
||||
return
|
||||
|
||||
if value is not None:
|
||||
# Check if value exists
|
||||
current_value = frontmatter[key]
|
||||
@@ -716,8 +732,9 @@ def delete(note_path, vault):
|
||||
@click.option('--delete', is_flag=True, help="Delete frontmatter keys")
|
||||
@click.option('--key', required=True, help="Frontmatter key to manage")
|
||||
@click.option('--value', help="Value to set or check for")
|
||||
@click.option('--open', 'open_file', is_flag=True, help="Open the file referenced in the value")
|
||||
@click.option('--vault', help="Vault name (if not using default)")
|
||||
def frontmatter_command(note_name, edit, view, clear, delete, key, value, vault):
|
||||
def frontmatter_command(note_name, edit, view, clear, delete, key, value, open_file, vault):
|
||||
"""Manage YAML frontmatter in notes
|
||||
|
||||
Must specify exactly one action: --edit, --view, --clear, or --delete
|
||||
@@ -734,7 +751,7 @@ def frontmatter_command(note_name, edit, view, clear, delete, key, value, vault)
|
||||
if edit:
|
||||
cli.frontmatter_edit(note_name, key, value, vault)
|
||||
elif view:
|
||||
cli.frontmatter_view(note_name, key, value, vault)
|
||||
cli.frontmatter_view(note_name, key, value, vault, open_file)
|
||||
elif clear:
|
||||
cli.frontmatter_clear(note_name, key, vault)
|
||||
elif delete:
|
||||
|
||||
Reference in new issue
Block a user