From 3f170c7fb8d96b0a8d9574f7b62a277125cacc3c Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Sun, 28 Jun 2020 13:16:10 -0400 Subject: [PATCH] Cal improvements (#2074) * .get() already checks for the argument, don't need to use .has() as well * Supplying the month-names flag should also cause the months column to show up, it should not require the -m flag first --- crates/nu-cli/src/commands/cal.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/nu-cli/src/commands/cal.rs b/crates/nu-cli/src/commands/cal.rs index 1970ba5f06..9bf9ad0d84 100644 --- a/crates/nu-cli/src/commands/cal.rs +++ b/crates/nu-cli/src/commands/cal.rs @@ -84,17 +84,15 @@ pub async fn cal( let mut selected_year: i32 = current_year; let mut current_day_option: Option = Some(current_day); - let month_range = if args.has("full-year") { - if let Some(full_year_value) = args.get("full-year") { - if let Ok(year_u64) = full_year_value.as_u64() { - selected_year = year_u64 as i32; + let month_range = if let Some(full_year_value) = args.get("full-year") { + if let Ok(year_u64) = full_year_value.as_u64() { + selected_year = year_u64 as i32; - if selected_year != current_year { - current_day_option = None - } - } else { - return Err(get_invalid_year_shell_error(&full_year_value.tag())); + if selected_year != current_year { + current_day_option = None } + } else { + return Err(get_invalid_year_shell_error(&full_year_value.tag())); } (1, 12) @@ -300,7 +298,7 @@ fn add_month_to_table( ); } - if should_show_month_column { + if should_show_month_column || should_show_month_names { let month_value = if should_show_month_names { UntaggedValue::string(month_helper.month_name.clone()).into_value(tag) } else {