feat: Support relays and naddrs sets

This commit introduces support for 'sets', a feature that simplifies
referencing multiple relays or naddrs with a single word.

Sets are stored in the config directory under `n34` as `config.toml` in
`TOML` format. The config path follows the `$XDG_CONFIG_HOME` standard,
defaulting to `$HOME/.config` if unset.

The `n34 sets` command allows managing sets, adding, removing, updating,
or displaying them. When using the main `--relays` flag, a set name can
be provided to automatically expand its relays (an error occurs if the
set contains no relays). Similarly, any command accepting naddrs can
reference a set to extract its naddrs.

Sets can also be merged by updating a set while specifying another
set in `--repo` merges their naddrs, while `--set-relays` merges their
relays. Removal follows the same pattern.

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-06-01 12:00:49 +00:00
parent d6d3f8a52f
commit 4c6578ccb1
19 changed files with 1010 additions and 97 deletions

View File

@@ -61,7 +61,14 @@ fn set_log_level(verbosity: Verbosity) {
#[tokio::main]
async fn main() -> ExitCode {
let cli = Cli::parse();
let cli = match cli::parsers::post_parse_cli(Cli::parse()) {
Ok(cli) => cli,
Err(err) => {
eprintln!("{err}");
return ExitCode::FAILURE;
}
};
set_log_level(cli.verbosity);
if let Err(err) = cli.run().await {