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
51
52
53
54
55
56
//! `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 Detect;
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. New subcommands land as siblings of `Trim` / `Detect` here.
// `name`/`bin_name` are pinned explicitly: clap otherwise derives the displayed
// program name from argv[0]'s basename, and the cargo-multivers fexecve/memfd
// launcher passes `/proc/self/fd/N` as argv[0] under binfmt emulation (e.g. an
// amd64 biocontainer on Apple Silicon), which would print `Usage: 11 ...`.
// See fulcrumgenomics/riker#38.
// 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.