Coverage for  / home / runner / work / bijux-cli / bijux-cli / src / bijux_cli / cli / commands / memory / __init__.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-01-26 17:59 +0000

1# SPDX-License-Identifier: Apache-2.0 

2# Copyright © 2025 Bijan Mousavi 

3 

4"""Defines the `memory` command group for the Bijux CLI. 

5 

6This module serves as the central entry point for managing the CLI's transient, 

7in-memory data store. It aggregates the various subcommands into a single 

8`Typer` application, creating the `bijux memory` command hierarchy. The data 

9in this store persists only for the lifetime of the application's parent process. 

10 

11The `memory` command, when run without a subcommand, provides a brief summary 

12of the memory store's state. 

13 

14The available subcommands are: 

15 * `set`: Sets a key-value pair. 

16 * `get`: Retrieves the value for a specific key. 

17 * `delete`: Removes a key-value pair. 

18 * `list`: Lists all defined keys. 

19 * `clear`: Removes all key-value pairs from the memory store. 

20 

21Exit codes for the subcommands generally follow this pattern: 

22 * `0`: Success. 

23 * `1`: An internal or unexpected error occurred (e.g., service unavailable). 

24 * `2`: An invalid argument was provided (e.g., bad format, invalid key). 

25 * `3`: An ASCII or encoding error was detected. 

26""" 

27 

28from __future__ import annotations 

29 

30import typer 

31 

32from bijux_cli.cli.commands.memory.clear import clear_memory 

33from bijux_cli.cli.commands.memory.delete import delete_memory 

34from bijux_cli.cli.commands.memory.get import get_memory 

35from bijux_cli.cli.commands.memory.list import list_memory 

36from bijux_cli.cli.commands.memory.service import memory 

37from bijux_cli.cli.commands.memory.set import set_memory 

38from bijux_cli.core.runtime import AsyncTyper 

39 

40typer.core.rich = None # type: ignore[attr-defined] 

41 

42memory_app = AsyncTyper( 

43 name="memory", 

44 help="Manage CLI memory.", 

45 rich_markup_mode=None, 

46 context_settings={"help_option_names": ["-h", "--help"]}, 

47 no_args_is_help=False, 

48) 

49 

50memory_app.callback(invoke_without_command=True)(memory) 

51 

52memory_app.command("set")(set_memory) 

53memory_app.command("get")(get_memory) 

54memory_app.command("delete")(delete_memory) 

55memory_app.command("clear")(clear_memory) 

56memory_app.command("list")(list_memory) 

57 

58__all__ = [ 

59 "memory_app", 

60]