mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Add --version flag to show installed version of khoj
This commit is contained in:
parent
372dcd2dbc
commit
1ac6a71ff0
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
# Standard Packages
|
# Standard Packages
|
||||||
import argparse
|
import argparse
|
||||||
import pathlib
|
import pathlib
|
||||||
|
from importlib.metadata import version
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.utils.helpers import resolve_absolute_path
|
from src.utils.helpers import resolve_absolute_path
|
||||||
|
@ -17,9 +18,15 @@ def cli(args=None):
|
||||||
parser.add_argument('--host', type=str, default='127.0.0.1', help="Host address of the server. Default: 127.0.0.1")
|
parser.add_argument('--host', type=str, default='127.0.0.1', help="Host address of the server. Default: 127.0.0.1")
|
||||||
parser.add_argument('--port', '-p', type=int, default=8000, help="Port of the server. Default: 8000")
|
parser.add_argument('--port', '-p', type=int, default=8000, help="Port of the server. Default: 8000")
|
||||||
parser.add_argument('--socket', type=pathlib.Path, help="Path to UNIX socket for server. Use to run server behind reverse proxy. Default: /tmp/uvicorn.sock")
|
parser.add_argument('--socket', type=pathlib.Path, help="Path to UNIX socket for server. Use to run server behind reverse proxy. Default: /tmp/uvicorn.sock")
|
||||||
|
parser.add_argument('--version', '-V', action='store_true', help="Print the installed Khoj version and exit")
|
||||||
|
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
|
|
||||||
|
if args.version:
|
||||||
|
# Show version of khoj installed and exit
|
||||||
|
print(version('khoj-assistant'))
|
||||||
|
exit(0)
|
||||||
|
|
||||||
# Normalize config_file path to absolute path
|
# Normalize config_file path to absolute path
|
||||||
args.config_file = resolve_absolute_path(args.config_file)
|
args.config_file = resolve_absolute_path(args.config_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue