MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / print_settings_json

Function print_settings_json

crates/chat-cli/src/cli/settings.rs:151–171  ·  view source on GitHub ↗

Print settings list in JSON or JSON Pretty format

(settings: &[SettingInfo], pretty: bool)

Source from the content-addressed store, hash-verified

149
150/// Print settings list in JSON or JSON Pretty format
151fn print_settings_json(settings: &[SettingInfo], pretty: bool) -> Result<()> {
152 let settings_list: Vec<_> = settings
153 .iter()
154 .map(|s| {
155 json!({
156 "key": s.key,
157 "description": s.description,
158 "current_value": s.current_value,
159 })
160 })
161 .collect();
162
163 let output = if pretty {
164 serde_json::to_string_pretty(&settings_list)?
165 } else {
166 serde_json::to_string(&settings_list)?
167 };
168
169 println!("{}", output);
170 Ok(())
171}
172
173/// Print all available settings
174fn print_all_settings(os: &Os, format: OutputFormat) -> Result<()> {

Callers 1

print_all_settingsFunction · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected