use crate::cli::clap::with_source_options;
use crate::cli::common::{COLLECTION_MODE_FORCE_REFRESH, collection_help};
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) fn refresh_command() -> ClapCommand {
with_source_options::<crate::nns::leaf::NnsLeafRefreshOptions>(
ClapCommand::new("refresh")
.about("Force-refresh and cache NNS subnet metadata")
.after_help(collection_help(
COLLECTION_MODE_FORCE_REFRESH,
REFRESH_HELP_AFTER,
)),
DEFAULT_SUBNET_CATALOG_SOURCE_ENDPOINT,
"IC API endpoint used for the NNS registry query",
)
.mut_arg("dry-run", |arg| {
arg.help("Fetch and validate without replacing the cached catalog")
})
.mut_arg("output", |arg| {
arg.help("Also write the fetched catalog JSON to this path")
})
}