chore: remove version check for unsupported nushell version (#4791)

This commit is contained in:
Takuya Uehara 2023-01-07 03:13:04 +09:00 committed by GitHub
parent 4fa7395c9e
commit fcdf2a0fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 20 deletions

View File

@ -263,8 +263,6 @@ the input line in a multi-line prompt, see the [`fill` module](/config/#fill).
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd, nushell. `right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd, nushell.
Note: Nushell 0.71.0 or later is required
### Example ### Example
```toml ```toml

View File

@ -12,28 +12,17 @@ let-env PROMPT_COMMAND = {
^::STARSHIP:: prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" ^::STARSHIP:: prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
} }
# Whether we can show right prompt on the last line
let has_rprompt_last_line_support = (version).version >= 0.71.0
# Whether we have config items # Whether we have config items
let has_config_items = (not ($env | get -i config | is-empty)) let has_config_items = (not ($env | get -i config | is-empty))
if $has_rprompt_last_line_support { let config = if $has_config_items {
let config = if $has_config_items { $env.config | upsert render_right_prompt_on_last_line true
$env.config | upsert render_right_prompt_on_last_line true
} else {
{render_right_prompt_on_last_line: true}
}
{config: $config}
} else { } else {
{ } {render_right_prompt_on_last_line: true}
} | load-env }
{config: $config} | load-env
let-env PROMPT_COMMAND_RIGHT = { let-env PROMPT_COMMAND_RIGHT = {
if $has_rprompt_last_line_support { let width = (term size).columns
let width = (term size).columns ^::STARSHIP:: prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
^::STARSHIP:: prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
} else {
''
}
} }