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

Method print_version

crates/chat-cli/src/cli/mod.rs:287–339  ·  view source on GitHub ↗
(changelog: Option<String>)

Source from the content-addressed store, hash-verified

285 }
286
287 fn print_version(changelog: Option<String>) -> Result<ExitCode> {
288 // If no changelog is requested, display normal version information
289 if changelog.is_none() {
290 let _ = writeln!(stdout(), "{}", Self::command().render_version());
291 return Ok(ExitCode::SUCCESS);
292 }
293
294 let changelog_value = changelog.unwrap_or_default();
295 let feed = Feed::load();
296
297 // Display changelog for all versions
298 if changelog_value == "all" {
299 let entries = feed.get_all_changelogs();
300 if entries.is_empty() {
301 println!("No changelog information available.");
302 } else {
303 println!("Changelog for all versions:");
304 for entry in entries {
305 Self::print_changelog_entry(&entry)?;
306 }
307 }
308 return Ok(ExitCode::SUCCESS);
309 }
310
311 // Display changelog for a specific version (--changelog=x.x.x)
312 if !changelog_value.is_empty() {
313 match feed.get_version_changelog(&changelog_value) {
314 Some(entry) => {
315 println!("Changelog for version {}:", changelog_value);
316 Self::print_changelog_entry(&entry)?;
317 return Ok(ExitCode::SUCCESS);
318 },
319 None => {
320 println!("No changelog information available for version {}.", changelog_value);
321 return Ok(ExitCode::SUCCESS);
322 },
323 }
324 }
325
326 // Display changelog for the current version (--changelog only)
327 let current_version = env!("CARGO_PKG_VERSION");
328 match feed.get_version_changelog(current_version) {
329 Some(entry) => {
330 println!("Changelog for version {}:", current_version);
331 Self::print_changelog_entry(&entry)?;
332 },
333 None => {
334 println!("No changelog information available for version {}.", current_version);
335 },
336 }
337
338 Ok(ExitCode::SUCCESS)
339 }
340}
341
342#[cfg(test)]

Callers

nothing calls this directly

Calls 3

get_all_changelogsMethod · 0.80
get_version_changelogMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected