mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 05:39:06 +00:00
Resolve config_file to absolute right at start on parsing args in cli
- Assume path is absolute in yaml util module while saving, loading file
- This follows same convention as jsonl. Which just operates on
passed file path, assuming it is of appropriate form.
Responsibility to put it in appropriate form is on the caller, for now
This commit is contained in:
@@ -3,7 +3,7 @@ import argparse
|
||||
import pathlib
|
||||
|
||||
# Internal Packages
|
||||
from src.utils.helpers import resolve_absolute_path
|
||||
from src.utils.helpers import get_absolute_path, resolve_absolute_path
|
||||
from src.utils.yaml import parse_config_from_file
|
||||
|
||||
|
||||
@@ -20,9 +20,12 @@ def cli(args=None):
|
||||
|
||||
args = parser.parse_args(args)
|
||||
|
||||
if not resolve_absolute_path(args.config_file).exists():
|
||||
# Normalize config_file path to absolute path
|
||||
args.config_file = resolve_absolute_path(args.config_file)
|
||||
|
||||
if not args.config_file.exists():
|
||||
args.config = None
|
||||
else:
|
||||
args.config = parse_config_from_file(args.config_file)
|
||||
|
||||
return args
|
||||
return args
|
||||
|
||||
Reference in New Issue
Block a user