Merge pull request #918 from almirus/develop
feat(cli): add version display and version flag to CLI
This commit is contained in:
+9
-1
@@ -34,6 +34,7 @@ import argparse
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .config import MempalaceConfig
|
from .config import MempalaceConfig
|
||||||
|
from .version import __version__
|
||||||
|
|
||||||
|
|
||||||
_MEMPALACE_PROJECT_FILES = ("mempalace.yaml", "entities.json")
|
_MEMPALACE_PROJECT_FILES = ("mempalace.yaml", "entities.json")
|
||||||
@@ -470,10 +471,17 @@ def cmd_compress(args):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
version_label = f"MemPalace {__version__}"
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="MemPalace — Give your AI a memory. No API key required.",
|
description="MemPalace — Give your AI a memory. No API key required.",
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
epilog=__doc__,
|
epilog=f"{version_label}\n\n{__doc__}",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--version",
|
||||||
|
action="version",
|
||||||
|
version=version_label,
|
||||||
|
help="Show version and exit",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--palace",
|
"--palace",
|
||||||
|
|||||||
Reference in New Issue
Block a user