Coverage for frappe_manager / commands / info.py: 56%

18 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-07-02 18:13 +0530

1from typing import Annotated 

2 

3import typer 

4from typer_examples import example 

5 

6from frappe_manager.commands import check_bench_migration_required 

7from frappe_manager.output_manager import get_global_output_handler, spinner 

8from frappe_manager.site_manager.site import Bench 

9from frappe_manager.utils.callbacks import ( 

10 sitename_callback, 

11 sites_autocompletion_callback, 

12) 

13 

14 

15@example( 

16 "Show bench details and configuration", 

17 "{benchname}", 

18 detail="Displays bench status, environment type, apps installed, and other configuration details useful for debugging and documentation.", 

19 benchname="mybench", 

20) 

21@example( 

22 "View info in verbose mode", 

23 "{benchname} --verbose", 

24 detail="Shows additional diagnostic information including container states and compose file paths.", 

25 benchname="mybench", 

26) 

27def info( 

28 ctx: typer.Context, 

29 benchname: Annotated[ 

30 str | None, 

31 typer.Argument( 

32 help="Name of the bench.", 

33 autocompletion=sites_autocompletion_callback, 

34 callback=sitename_callback, 

35 ), 

36 ] = None, 

37): 

38 """ 

39 Show bench information and configuration. 

40 

41 Displays bench status, installed apps, environments, and other relevant configuration. 

42 """ 

43 

44 check_bench_migration_required(benchname) 

45 

46 services_manager = ctx.obj["services"] 

47 verbose = ctx.obj["verbose"] 

48 

49 output = get_global_output_handler() 

50 logger = ctx.obj.get("logger") 

51 bench = Bench.get_object(benchname, services_manager, logger=logger, output_handler=output) 

52 

53 with spinner(output, "Getting bench info"): 

54 bench.info()