mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
"short" Welcome Banner option (#14638)
# Description Adds: ```nushell $env.config.show_banner = "short" ``` This will display *only* the startup time. That was the only information from the banner that the user couldn't possibly include in their own config/banner (since it is `-1ns` during startup). This allows one to create their own banner and yet still show the startup time. Example (can be a file named `banner.nu` in autoloads: ```nushell $env.config.show_banner = "short" let ver = (version) print $"(ansi blue_bold)Nushell Release:(ansi reset) ($ver.version) \(($ver.build_os)\)" ```  --- `true` and `false` settings continue to work as they do today. `true` is still the default. # User-Facing Changes New configuration option: ```nushell $env.config.show_banner = "short" ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting ◼️ Update doc ◼️ Update `doc_config.nu`
This commit is contained in:
@ -1,11 +1,17 @@
|
||||
use std/dt [datetime-diff, pretty-print-duration]
|
||||
|
||||
# Print a banner for nushell with information about the project
|
||||
export def banner [] {
|
||||
export def banner [
|
||||
--short # Only show startup time
|
||||
] {
|
||||
let dt = (datetime-diff (date now) 2019-05-10T09:59:12-07:00)
|
||||
let ver = (version)
|
||||
let startup_time = $"(ansi green_bold)Startup Time: (ansi reset)($nu.startup-time)"
|
||||
|
||||
let banner_msg = $"(ansi green) __ ,(ansi reset)
|
||||
let banner_msg = match $short {
|
||||
true => $"($startup_time)(char newline)"
|
||||
|
||||
false => $"(ansi green) __ ,(ansi reset)
|
||||
(ansi green) .--\(\)°'.' (ansi reset)Welcome to (ansi green)Nushell(ansi reset),
|
||||
(ansi green)'|, . ,' (ansi reset)based on the (ansi green)nu(ansi reset) language,
|
||||
(ansi green) !_-\(_\\ (ansi reset)where all data is structured!
|
||||
@ -20,8 +26,9 @@ Learn how to remove this at: (ansi green)https://nushell.sh/book/configuration.h
|
||||
It's been this long since (ansi green)Nushell(ansi reset)'s first commit:
|
||||
(pretty-print-duration $dt)
|
||||
|
||||
Startup Time: ($nu.startup-time)
|
||||
($startup_time)
|
||||
"
|
||||
}
|
||||
|
||||
match $env.config?.use_ansi_coloring? {
|
||||
false => { $banner_msg | ansi strip }
|
||||
|
Reference in New Issue
Block a user