1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! `chelae` — a FASTQ trimming and filtering toolkit. This file is the CLI entry
//! point; it dispatches to the set of subcommands via the [`Command`] trait and
//! `enum_dispatch`. Installs `mimalloc` as the global allocator.
extern crate core;
use Result;
use Parser;
use Command;
use Trim;
use enum_dispatch;
use Env;
static GLOBAL: MiMalloc = MiMalloc;
/// Top-level `chelae` CLI parser. Holds a single [`Subcommand`] variant chosen by the
/// user's argv; every subcommand enum variant in turn wraps that subcommand's own
/// clap-derived options struct.
/// Exhaustive list of `chelae` subcommands, wired to the [`Command`] trait via
/// `enum_dispatch` so `execute()` forwards to the chosen variant without a match arm
/// per-subcommand. Kept as a multi-subcommand enum even while `Trim` is the only
/// variant to leave room for future tools without a CLI shape change.
// Single enum instance per program; a large variant like Trim doesn't warrant a
// Box layer on the hot path.
/// Process entry point. Initializes env_logger with a default of `info` level,
/// parses argv, and dispatches to the selected subcommand's `execute()`. Errors
/// propagate out as `anyhow::Error` for the runtime's default `eprintln!` +
/// nonzero-exit handling.