nimbus_cli/output/fetch.rs
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5use std::path::Path;
6
7use anyhow::Result;
8use serde_json::Value;
9
10use crate::{sources::ExperimentListSource, value_utils};
11
12impl ExperimentListSource {
13 pub(crate) fn fetch_list<P>(&self, file: Option<P>) -> Result<bool>
14 where
15 P: AsRef<Path>,
16 {
17 let value: Value = self.try_into()?;
18 value_utils::write_to_file_or_print(file, &value)?;
19
20 Ok(true)
21 }
22}