use crate::cli::common::current_unix_secs;
use crate::nns::{
NnsCommandError, topology::options::topology_refresh_request, write_text_or_json,
};
use crate::presentation::nns::topology::nns_topology_refresh_report_text;
use crate::storage::cache_root;
use ic_query::nns::topology::refresh_nns_topology_report_with_source;
pub(super) async fn run_topology_refresh(
options: super::super::commands::TopologyRefreshOptions,
network: &str,
) -> Result<(), NnsCommandError> {
let (format, request) =
topology_refresh_request(options, network, cache_root()?, current_unix_secs()?);
let report =
refresh_nns_topology_report_with_source(&request, &ic_query::nns::LiveNnsSource::default())
.await?;
write_text_or_json(format, &report, nns_topology_refresh_report_text)
}