mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:24:58 +02:00
Improves startup time when using std-lib
This commit is contained in:
33
crates/nu-std/std/core.nu
Normal file
33
crates/nu-std/std/core.nu
Normal file
@ -0,0 +1,33 @@
|
||||
use dt.nu [datetime-diff, pretty-print-duration]
|
||||
|
||||
# Print a banner for nushell with information about the project
|
||||
export def banner [] {
|
||||
let dt = (datetime-diff (date now) 2019-05-10T09:59:12-07:00)
|
||||
$"(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!
|
||||
|
||||
Please join our (ansi purple)Discord(ansi reset) community at (ansi purple)https://discord.gg/NtAbbGn(ansi reset)
|
||||
Our (ansi green_bold)GitHub(ansi reset) repository is at (ansi green_bold)https://github.com/nushell/nushell(ansi reset)
|
||||
Our (ansi green)Documentation(ansi reset) is located at (ansi green)https://nushell.sh(ansi reset)
|
||||
(ansi cyan)Tweet(ansi reset) us at (ansi cyan_bold)@nu_shell(ansi reset)
|
||||
Learn how to remove this at: (ansi green)https://nushell.sh/book/configuration.html#remove-welcome-message(ansi reset)
|
||||
|
||||
It's been this long since (ansi green)Nushell(ansi reset)'s first commit:
|
||||
(pretty-print-duration $dt)
|
||||
|
||||
Startup Time: ($nu.startup-time)
|
||||
"
|
||||
}
|
||||
|
||||
# Return the current working directory
|
||||
export def pwd [
|
||||
--physical (-P) # resolve symbolic links
|
||||
] {
|
||||
if $physical {
|
||||
$env.PWD | path expand
|
||||
} else {
|
||||
$env.PWD
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
# std.nu, `used` to load all standard library components
|
||||
|
||||
export module core.nu
|
||||
export module assert.nu
|
||||
export module dirs.nu
|
||||
export module dt.nu
|
||||
@ -15,8 +16,6 @@ export-env {
|
||||
use log.nu []
|
||||
}
|
||||
|
||||
use dt.nu [datetime-diff, pretty-print-duration]
|
||||
|
||||
# Add the given paths to the PATH.
|
||||
#
|
||||
# # Example
|
||||
@ -160,27 +159,6 @@ export def bench [
|
||||
}
|
||||
}
|
||||
|
||||
# Print a banner for nushell with information about the project
|
||||
export def banner [] {
|
||||
let dt = (datetime-diff (date now) 2019-05-10T09:59:12-07:00)
|
||||
$"(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!
|
||||
|
||||
Please join our (ansi purple)Discord(ansi reset) community at (ansi purple)https://discord.gg/NtAbbGn(ansi reset)
|
||||
Our (ansi green_bold)GitHub(ansi reset) repository is at (ansi green_bold)https://github.com/nushell/nushell(ansi reset)
|
||||
Our (ansi green)Documentation(ansi reset) is located at (ansi green)https://nushell.sh(ansi reset)
|
||||
(ansi cyan)Tweet(ansi reset) us at (ansi cyan_bold)@nu_shell(ansi reset)
|
||||
Learn how to remove this at: (ansi green)https://nushell.sh/book/configuration.html#remove-welcome-message(ansi reset)
|
||||
|
||||
It's been this long since (ansi green)Nushell(ansi reset)'s first commit:
|
||||
(pretty-print-duration $dt)
|
||||
|
||||
Startup Time: ($nu.startup-time)
|
||||
"
|
||||
}
|
||||
|
||||
# the cute and friendly mascot of Nushell :)
|
||||
export def ellie [] {
|
||||
let ellie = [
|
||||
@ -193,17 +171,6 @@ export def ellie [] {
|
||||
$ellie | str join "\n" | $"(ansi green)($in)(ansi reset)"
|
||||
}
|
||||
|
||||
# Return the current working directory
|
||||
export def pwd [
|
||||
--physical (-P) # resolve symbolic links
|
||||
] {
|
||||
if $physical {
|
||||
$env.PWD | path expand
|
||||
} else {
|
||||
$env.PWD
|
||||
}
|
||||
}
|
||||
|
||||
# repeat anything a bunch of times, yielding a list of *n* times the input
|
||||
#
|
||||
# # Examples
|
||||
|
Reference in New Issue
Block a user