feat: Enhance OnyxCLI functionality
- Added functionality to open directories in the system explorer when a directory path is provided. - Improved output formatting for frontmatter values in the OnyxCLI, allowing for raw value display when a single key is requested. - Updated the `things to fix.md` with new tasks: trimming content of tags and adding multiple properties at once.
This commit is contained in:
1 parent
a7074acd91
commit
a82cb97267
11 files changed
+1201
-724
No files matched your search
+17
-1
@@ -230,6 +230,18 @@ class OnyxCLI:
|
||||
|
||||
# Try exact path first
|
||||
note_path = vault_path / note_name
|
||||
|
||||
# Check if it's a directory first
|
||||
if note_path.is_dir():
|
||||
# Open directory in system explorer
|
||||
if sys.platform == 'win32':
|
||||
os.startfile(note_path)
|
||||
elif sys.platform == 'darwin':
|
||||
subprocess.run(['open', note_path])
|
||||
else:
|
||||
subprocess.run(['xdg-open', note_path])
|
||||
return
|
||||
|
||||
if not note_path.suffix:
|
||||
note_path = note_path.with_suffix('.md')
|
||||
|
||||
@@ -565,7 +577,11 @@ class OnyxCLI:
|
||||
result = str(current_value) == value
|
||||
click.echo(f"{k}: {str(result).lower()}")
|
||||
else:
|
||||
click.echo(yaml.dump({k: frontmatter[k]}, default_flow_style=False).strip())
|
||||
# If single key requested and no value check, print raw value
|
||||
if len(keys) == 1 and len(sub_keys) == 1:
|
||||
click.echo(str(frontmatter[k]))
|
||||
else:
|
||||
click.echo(yaml.dump({k: frontmatter[k]}, default_flow_style=False).strip())
|
||||
|
||||
def _handle_open_file(self, current_value, vault):
|
||||
val_str = str(current_value)
|
||||
|
||||
Reference in new issue
Block a user