Skip to content

Follow-up: reorganize main.rs command dispatch and split cli.rs #67

Description

@cjfields

Follow-up to the module reorg in #66 (LOESS → loess.rs, WFA → wfa.rs, lib crate introduced). That pass deliberately left the two largest files untouched to keep the diff reviewable. This issue tracks the remaining structural cleanup.

main.rs (~4.6k lines)

It's a god-file: CLI dispatch plus the full inline orchestration for all ~21 Commands::X subcommands plus ~20 helpers. With the dada2_rs lib crate now in place (#66), command handlers can move out cleanly.

Options considered previously:

  • Grouped handlers (recommended starting point): group related commands into a few modules — e.g. commands/dada.rs (dada / dada-pooled / dada-pseudo), commands/chimera.rs, commands/taxonomy.rs (assign-taxonomy / assign-species / tax-to-tsv), commands/seqtable.rs (make-sequence-table / seqtable-to-tsv|fasta), commands/errors.rs (learn-errors / errors-from-sample / kdist-calibrate). main.rs shrinks to argument parsing + dispatch.
  • Full per-command modules (src/commands/<name>.rs per arm) — cleanest end state, most churn.

Constraint: keep each handler's logic behavior-preserving; verify with the existing concordance/parity tests + byte-identical outputs.

cli.rs (~2.2k lines)

Structurally fine (clap Commands enum + arg structs) but large. Lower priority — consider splitting the clap definitions per command group only if it aids navigation, or leave as-is.

Acceptance

  • No behavior change (byte-identical outputs; full test suite green on default and --features wfa).
  • main.rs reduced to dispatch + shared helpers.
  • No performance regression (hot code already lives in the lib crate).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions