forked from CubeCraftLabs/CTXD
18 lines
691 B
Python
18 lines
691 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""ctxd module entry point — CLI when args given, daemon otherwise."""
|
||
|
|
import sys
|
||
|
|
|
||
|
|
if len(sys.argv) > 1 and sys.argv[1] in ('init', 'serve', 'project-list', 'project-create',
|
||
|
|
'read', 'cat', 'edit', 'search', 'sync', 'audit',
|
||
|
|
'user-list', 'user-create', 'import-vault'):
|
||
|
|
from ctxd.cli import cli_entry
|
||
|
|
cli_entry()
|
||
|
|
else:
|
||
|
|
from ctxd.config import CtxConfig
|
||
|
|
from ctxd.server import serve_sync
|
||
|
|
|
||
|
|
cfg = CtxConfig.from_home()
|
||
|
|
if not cfg.db_path.exists():
|
||
|
|
print("Not initialized. Run 'ctx init' first.", file=sys.stderr)
|
||
|
|
sys.exit(1)
|
||
|
|
serve_sync(cfg)
|