Coverage for src/prosemark/cli/write.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-09-24 18:08 +0000

1"""CLI command for freewriting sessions. 

2 

3DEPRECATED: This module is kept for backward compatibility. 

4The actual write command is now implemented in main.py using Typer 

5and the new freewriting TUI interface. 

6""" 

7 

8from pathlib import Path 

9 

10import click 

11 

12from prosemark.freewriting.container import run_freewriting_session 

13 

14 

15@click.command() 

16@click.argument('node_uuid', required=False) 

17@click.option('--title', '-t', help='Session title') 

18@click.option('--words', '-w', type=int, help='Word count goal') 

19@click.option('--time', type=int, help='Time limit in minutes') 

20@click.option('--path', '-p', type=click.Path(path_type=Path), help='Project directory') 

21def write_command( 

22 node_uuid: str | None, 

23 title: str | None, 

24 words: int | None, 

25 time: int | None, 

26 path: Path | None, 

27) -> None: 

28 """Start a freewriting session in a distraction-free TUI.""" 

29 try: 

30 project_root = path or Path.cwd() 

31 

32 # Use the new freewriting container for dependency injection 

33 run_freewriting_session( 

34 node_uuid=node_uuid, 

35 title=title, 

36 word_count_goal=words, 

37 time_limit=time, 

38 project_path=project_root, 

39 ) 

40 

41 except Exception as e: 

42 click.echo(f'Error: {e}', err=True) 

43 raise SystemExit(1) from e