diff options
| author | tv <tv@krebsco.de> | 2026-12-02 16:24:19 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-02 17:08:52 +0000 |
| commit | 2be9ca2b75d099a9ca04078f2182acda074ed270 (patch) | |
| tree | acd772e1873e566e2022f068628179bbd53eb8e9 /src/federation | |
| parent | 1de11da61a106187748c4b79e1d7b63e3b9d172f (diff) | |
config: a configuration names importers of its own
[meta.importer] in a file, or --meta-importer-NAME IMPORTER, names an
importer: NAME:REST, { NAME = "REST" } and a placeholder of that name
are then that importer, with REST as its variable `name`. So what would
be built in for one tool, pass:NAME, is written by who uses it, once:
pass = { command = ["pass", "show", "$(var:name)"] }.
A name counts in every file and argument, wherever it is given; of two
of one name, the later source's. What follows the name goes in as every
variable does, as data. One named may be defined through others, not
through itself. `meta` at the top of a configuration file is what the
configuration says about itself. The argument is spelled as every
option's, the table's keys joined with `-`; as its name is the
configuration's, it is taken off the command line before the command
reads it.
Diffstat (limited to 'src/federation')
| -rw-r--r-- | src/federation/party.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs index eaf28b5..17e3f0e 100644 --- a/src/federation/party.rs +++ b/src/federation/party.rs @@ -627,7 +627,13 @@ fn begin_federation(dir: &Path, matches: &ArgMatches) -> Result<()> { /// Runs the client, as its arguments say. pub(crate) async fn main() -> Result<()> { - let matches = command().get_matches(); + // The importers it names, off the command line first: their names are its own. + let mut arguments = std::env::args(); + let program = arguments + .next() + .unwrap_or_else(|| "continuum-party".to_owned()); + let (arguments, named) = ::config::arguments::take_importers(arguments)?; + let matches = command().get_matches_from(std::iter::once(program).chain(arguments)); let (name, sub) = matches.subcommand().expect("a subcommand is required"); // Those that use no options read no federation's. let dir = if matches!(name, "twice" | "root" | "judge" | "found") { @@ -651,7 +657,7 @@ pub(crate) async fn main() -> Result<()> { .map(|dir| dir.join("party.toml")) .filter(|file| file.exists()) .collect(); - let (merged, _) = config::merged(&matches, &config::PARTY, &first)?; + let (merged, _) = ::config::arguments::merged_in(&matches, &config::PARTY, &first, &named)?; let mut options: Options = config::read(&merged)?; // In a federation's directory, its record and key, where none other is named. if let Some(dir) = &dir { |
