mirror of
https://github.com/nushell/nushell.git
synced 2025-07-30 12:32:11 +02:00
# Description Bump nushell to development version. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # 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. -->
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
# Default Nushell Environment Config File
|
|
# These "sensible defaults" are set before the user's `env.nu` is loaded
|
|
#
|
|
# version = "0.105.2"
|
|
|
|
$env.PROMPT_COMMAND = {||
|
|
let dir = match (do -i { $env.PWD | path relative-to $nu.home-path }) {
|
|
null => $env.PWD
|
|
'' => '~'
|
|
$relative_pwd => ([~ $relative_pwd] | path join)
|
|
}
|
|
|
|
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
|
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
|
let path_segment = $"($path_color)($dir)(ansi reset)"
|
|
|
|
$path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
|
|
}
|
|
|
|
$env.PROMPT_COMMAND_RIGHT = {||
|
|
# create a right prompt in magenta with green separators and am/pm underlined
|
|
let time_segment = ([
|
|
(ansi reset)
|
|
(ansi magenta)
|
|
(date now | format date '%x %X') # try to respect user's locale
|
|
] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
|
str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
|
|
|
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
|
(ansi rb)
|
|
($env.LAST_EXIT_CODE)
|
|
] | str join)
|
|
} else { "" }
|
|
|
|
([$last_exit_code, (char space), $time_segment] | str join)
|
|
} |