Skip to content

Refactor: Split main.rs into smaller modules #83

@evansenter

Description

@evansenter

Summary

main.rs is currently ~1500 lines (after TUI removal in PR #86), still above the 500-line guideline. It mixes several concerns:

  • CLI parsing and Args struct
  • OutputSink trait and implementations (LoggingOutputSink)
  • OUTPUT_SINK global state
  • Interactive REPL logic

Proposed Split

New Module Contents Why
src/cli.rs CLI parsing, Args struct Separate concern
src/repl.rs Interactive REPL logic, builtin commands Separate concern

OutputSink to logging.rs: Move OutputSink trait, LoggingOutputSink, and OUTPUT_SINK global to logging.rs. This is the right home because:

  • OutputSink controls where log_event() output goes
  • logging.rs already has log_event() and related functions
  • Keeps all logging infrastructure together

Current State

After PR #86 (TUI removal):

  • No more TuiSink, TuiEventHandler
  • OutputSink implementations: just LoggingOutputSink
  • main.rs is cleaner but still too large

Effort

Medium - requires careful extraction to avoid circular dependencies.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions