use crate::{
cli::{
clap::flag_arg,
common::{COLLECTION_MODE_FORCE_REFRESH, collection_help},
},
nns::leaf,
};
use clap::Command as ClapCommand;
use ic_query::subnet_catalog::DEFAULT_SUBNET_CATALOG_SOURCE_ENDPOINT;
const REFRESH_HELP_AFTER: &str = "\
Examples:
icq nns subnet refresh
icq --network ic nns subnet refresh --json
icq nns subnet refresh --dry-run --output /tmp/icq-subnet-catalog.preview.json";
pub(in crate::nns::subnet) fn refresh_command() -> ClapCommand {
ClapCommand::new("refresh")
.bin_name("icq nns subnet refresh")
.about("Force-refresh and cache NNS subnet metadata")
.arg(leaf::json_arg())
.arg(
leaf::source_endpoint_arg(DEFAULT_SUBNET_CATALOG_SOURCE_ENDPOINT)
.help("IC API endpoint used for the NNS registry query"),
)
.arg(leaf::refresh_lock_stale_after_arg())
.arg(
flag_arg("dry-run")
.long("dry-run")
.help("Fetch and validate without replacing the cached catalog"),
)
.arg(leaf::output_path_arg().help("Also write the fetched catalog JSON to this path"))
.after_help(collection_help(
COLLECTION_MODE_FORCE_REFRESH,
REFRESH_HELP_AFTER,
))
}