mirror of
https://github.com/nushell/nushell
synced 2024-11-15 09:27:08 +00: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
1 changed files with 8 additions and 10 deletions
|
@ -84,8 +84,7 @@ pub async fn cal(
|
|||
let mut selected_year: i32 = current_year;
|
||||
let mut current_day_option: Option<u32> = Some(current_day);
|
||||
|
||||
let month_range = if args.has("full-year") {
|
||||
if let Some(full_year_value) = args.get("full-year") {
|
||||
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;
|
||||
|
||||
|
@ -95,7 +94,6 @@ pub async fn cal(
|
|||
} else {
|
||||
return Err(get_invalid_year_shell_error(&full_year_value.tag()));
|
||||
}
|
||||
}
|
||||
|
||||
(1, 12)
|
||||
} 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 {
|
||||
UntaggedValue::string(month_helper.month_name.clone()).into_value(tag)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue