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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
//
// This file is part of Zond, licensed under the GNU Affero General Public
// License, version 3 or later. See the LICENSE file for details, or
// <https://www.gnu.org/licenses/agpl-3.0.html>.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
//! # Zond, as a command-line tool
//!
//! The front end to [`zond_engine`]. The engine finds hosts and ports; this
//! binary decides what a person typed, what to show them, and what to tell the
//! shell afterwards.
//!
//! The engine takes an already-resolved set of addresses, emits `tracing` events
//! and installs no subscriber, and holds no opinion about terminals. The four
//! modules with any judgement in them are what follows from that:
//!
//! - [`cli`] — the grammar, and how it becomes a
//! [`ZondConfig`](zond_engine::ZondConfig).
//! - [`target`] — what a target expression stands for. `lan` and `%en0` need the
//! host's interface table, which the engine's parser will not read for itself.
//! - [`render`] — what a run looks like. The only thing here that knows about
//! columns and streams.
//! - [`exit`] — what the shell is told, written down rather than improvised.
//!
//! [`command`] drives those against the engine, one module per subcommand.
//! [`diagnostics`] is the subscriber the engine's events would otherwise fall
//! into the void without. [`input`] is how a person stops a running scan.
//!
//! **Standard output carries records. Standard error carries narration.** So
//! `zond discover lan > hosts.txt` leaves a file with nothing in it but hosts,
//! and the person who ran it still watches the sweep happen.
use ExitCode;
use Parser;
use crate;
use crateError;
use crateOutcome;
async
/// Runs a parsed command line to completion.
///
/// The one place the pieces are wired together: diagnostics are installed, a
/// renderer is chosen, and the subcommand is handed both.
async
/// Creates the two settings files if this is the first run that can.
///
/// Fails at nothing: a home that cannot be written to means built-in defaults,
/// not a refusal to scan. A file that has just appeared is mentioned once,
/// because a program that writes into somebody's home should say so.