mirror of
https://github.com/nushell/nushell.git
synced 2025-04-21 19:58:21 +02:00
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
This commit is contained in:
parent
8d91d151bf
commit
3f170c7fb8
@ -84,8 +84,7 @@ pub async fn cal(
|
|||||||
let mut selected_year: i32 = current_year;
|
let mut selected_year: i32 = current_year;
|
||||||
let mut current_day_option: Option<u32> = Some(current_day);
|
let mut current_day_option: Option<u32> = Some(current_day);
|
||||||
|
|
||||||
let month_range = if args.has("full-year") {
|
let month_range = if let Some(full_year_value) = args.get("full-year") {
|
||||||
if let Some(full_year_value) = args.get("full-year") {
|
|
||||||
if let Ok(year_u64) = full_year_value.as_u64() {
|
if let Ok(year_u64) = full_year_value.as_u64() {
|
||||||
selected_year = year_u64 as i32;
|
selected_year = year_u64 as i32;
|
||||||
|
|
||||||
@ -95,7 +94,6 @@ pub async fn cal(
|
|||||||
} else {
|
} else {
|
||||||
return Err(get_invalid_year_shell_error(&full_year_value.tag()));
|
return Err(get_invalid_year_shell_error(&full_year_value.tag()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
(1, 12)
|
(1, 12)
|
||||||
} else {
|
} else {
|
||||||
@ -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 {
|
let month_value = if should_show_month_names {
|
||||||
UntaggedValue::string(month_helper.month_name.clone()).into_value(tag)
|
UntaggedValue::string(month_helper.month_name.clone()).into_value(tag)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user