Support external vault roots across tooling
This commit is contained in:
@@ -18,6 +18,8 @@ from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
from vault_root import parse_vault_args
|
||||
|
||||
|
||||
# Obsidian-style wiki link: [[target#anchor|alias]]
|
||||
WIKI_LINK_RE = re.compile(r"\[\[([^\]|#]+)(?:#[^\]|]+)?(?:\|([^\]]+))?\]\]")
|
||||
@@ -438,7 +440,7 @@ def parse_args() -> argparse.Namespace:
|
||||
action="store_true",
|
||||
help="write index/graph.json (default unless --validate is used alone)",
|
||||
)
|
||||
return parser.parse_args()
|
||||
return parse_vault_args(parser)
|
||||
|
||||
|
||||
def print_unresolved(unresolved: List[UnresolvedLink]) -> None:
|
||||
@@ -502,7 +504,7 @@ def print_invalid_node_types(invalid: List[Dict[str, object]]) -> None:
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
root = args.vault_root
|
||||
output = root / "index" / "graph.json"
|
||||
should_write = args.write or not args.validate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user