mirror of
https://github.com/nushell/nushell.git
synced 2025-08-25 22:56:06 +02:00
print nushell startup time (#7831)
# Description This PR shows the startup time and decreases the banner. This startup time output can be disabled with the `show_banner: false` setting in the config. This is the startup in debug mode.  On my mac in release mode ``` Startup Time: 368ms 429µs 83ns ``` On my mac without a config as `nu --config foo --env-config foo` ``` Startup Time: 11ms 663µs 791ns ``` I could really go either way on this. If people don't like this change, we don't have to merge it. # User-Facing Changes Startup Time # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
@@ -8,24 +8,24 @@ name = "nu-cli"
|
||||
version = "0.74.1"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { path="../nu-test-support", version = "0.74.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.74.1" }
|
||||
nu-command = { path = "../nu-command", version = "0.74.1" }
|
||||
rstest = {version = "0.15.0", default-features = false}
|
||||
rstest = { version = "0.15.0", default-features = false }
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.74.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.74.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.74.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.74.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.74.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.74.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.74.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.74.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.74.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.74.1" }
|
||||
nu-ansi-term = "0.46.0"
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.74.1" }
|
||||
reedline = { version = "0.14.0", features = ["bashisms", "sqlite"]}
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.74.1" }
|
||||
reedline = { version = "0.14.0", features = ["bashisms", "sqlite"] }
|
||||
|
||||
atty = "0.2.14"
|
||||
chrono = { default-features = false, features = ["std"], version = "0.4.23" }
|
||||
crossterm = "0.24.0"
|
||||
fancy-regex = "0.10.0"
|
||||
fancy-regex = "0.11.0"
|
||||
fuzzy-matcher = "0.3.7"
|
||||
is_executable = "1.0.1"
|
||||
once_cell = "1.17.0"
|
||||
|
@@ -41,6 +41,7 @@ pub fn evaluate_repl(
|
||||
stack: &mut Stack,
|
||||
nushell_path: &str,
|
||||
prerun_command: Option<Spanned<String>>,
|
||||
start_time: Instant,
|
||||
) -> Result<()> {
|
||||
use reedline::{FileBackedHistory, Reedline, Signal};
|
||||
|
||||
@@ -307,6 +308,13 @@ pub fn evaluate_repl(
|
||||
column!()
|
||||
);
|
||||
|
||||
if entry_num == 1 && show_banner {
|
||||
println!(
|
||||
"Startup Time: {}",
|
||||
format_duration(start_time.elapsed().as_nanos() as i64)
|
||||
);
|
||||
}
|
||||
|
||||
let input = line_editor.read_line(prompt);
|
||||
let shell_integration = config.shell_integration;
|
||||
|
||||
@@ -578,15 +586,7 @@ Our {}Documentation{} is located at {}http://nushell.sh{}
|
||||
{}Tweet{} us at {}@nu_shell{}
|
||||
|
||||
It's been this long since {}Nushell{}'s first commit:
|
||||
{}
|
||||
|
||||
{}You can disable this banner using the {}config nu{}{} command
|
||||
to modify the config.nu file and setting show_banner to false.
|
||||
|
||||
let-env config = {{
|
||||
show_banner: false
|
||||
...
|
||||
}}{}
|
||||
{}{}
|
||||
"#,
|
||||
"\x1b[32m", //start line 1 green
|
||||
"\x1b[32m", //start line 2
|
||||
@@ -618,11 +618,7 @@ let-env config = {{
|
||||
"\x1b[32m", //before Nushell
|
||||
"\x1b[0m", //after Nushell
|
||||
age,
|
||||
"\x1b[2;37m", //before banner disable dim white
|
||||
"\x1b[2;36m", //before config nu dim cyan
|
||||
"\x1b[0m", //after config nu
|
||||
"\x1b[2;37m", //after config nu dim white
|
||||
"\x1b[0m", //after banner disable
|
||||
"\x1b[0m", //after banner disable
|
||||
);
|
||||
|
||||
banner
|
||||
|
@@ -34,10 +34,7 @@ base64 = "0.21.0"
|
||||
byteorder = "1.4.3"
|
||||
bytesize = "1.1.0"
|
||||
calamine = "0.19.1"
|
||||
chrono = { version = "0.4.23", features = [
|
||||
"unstable-locales",
|
||||
"std",
|
||||
], default-features = false }
|
||||
chrono = { version = "0.4.23", features = ["unstable-locales", "std"], default-features = false }
|
||||
chrono-humanize = "0.2.1"
|
||||
chrono-tz = "0.6.3"
|
||||
crossterm = "0.24.0"
|
||||
@@ -47,7 +44,7 @@ digest = { default-features = false, version = "0.10.0" }
|
||||
dtparse = "1.2.0"
|
||||
eml-parser = "0.1.0"
|
||||
encoding_rs = "0.8.30"
|
||||
fancy-regex = "0.10.0"
|
||||
fancy-regex = "0.11.0"
|
||||
filesize = "0.2.0"
|
||||
filetime = "0.2.15"
|
||||
fs_extra = "1.2.0"
|
||||
@@ -59,9 +56,7 @@ Inflector = "0.11"
|
||||
is-root = "0.1.2"
|
||||
itertools = "0.10.0"
|
||||
log = "0.4.14"
|
||||
lscolors = { version = "0.12.0", features = [
|
||||
"crossterm",
|
||||
], default-features = false }
|
||||
lscolors = { version = "0.12.0", features = ["crossterm"], default-features = false }
|
||||
md5 = { package = "md-5", version = "0.10.0" }
|
||||
mime = "0.3.16"
|
||||
mime_guess = "2.0.4"
|
||||
@@ -147,20 +142,14 @@ features = [
|
||||
|
||||
[target.'cfg(windows)'.dependencies.windows]
|
||||
version = "0.43.0"
|
||||
features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_Storage_FileSystem",
|
||||
"Win32_System_SystemServices",
|
||||
]
|
||||
features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_SystemServices"]
|
||||
|
||||
[features]
|
||||
trash-support = ["trash"]
|
||||
which-support = ["which"]
|
||||
plugin = ["nu-parser/plugin"]
|
||||
dataframe = ["polars", "num", "sqlparser"]
|
||||
sqlite = [
|
||||
"rusqlite",
|
||||
] # TODO: given that rusqlite is included in reedline, should we just always include it?
|
||||
sqlite = ["rusqlite"] # TODO: given that rusqlite is included in reedline, should we just always include it?
|
||||
|
||||
[build-dependencies]
|
||||
shadow-rs = { version = "0.20.0", default-features = false }
|
||||
|
Reference in New Issue
Block a user