feat(ZSH): auto start nushell if it exits when init zsh
This commit is contained in:
@@ -3,7 +3,8 @@ export def --env "pj starship config" [name: string] {
|
||||
echo "starship is not installed."
|
||||
return
|
||||
}
|
||||
$env.starship_config = ($env.NU_POLYJUICE_PATH | path join ".." "starship" $"starship_($name).toml")
|
||||
let cfg = ($env.NU_POLYJUICE_PATH | path join ".." "starship" $"starship_($name).toml")
|
||||
$env.STARSHIP_CONFIG = $cfg
|
||||
}
|
||||
|
||||
export def --env "pj starship list" [] {
|
||||
@@ -14,6 +15,28 @@ export def --env "pj starship list" [] {
|
||||
ls ($env.NU_POLYJUICE_PATH | path join ".." "starship") -s | get name | parse -r '^(starship_(?<name>.*).toml)$' | get name
|
||||
}
|
||||
|
||||
export def "pj starship doctor" [] {
|
||||
let installed = ((which ^starship | length) > 0)
|
||||
let prompt_type = ($env.PROMPT_COMMAND? | describe)
|
||||
let right_prompt_type = ($env.PROMPT_COMMAND_RIGHT? | describe)
|
||||
let prompt_cmd = (($env.PROMPT_COMMAND? | to nuon --serialize) | default "<not-set>")
|
||||
let right_prompt_cmd = (($env.PROMPT_COMMAND_RIGHT? | to nuon --serialize) | default "<not-set>")
|
||||
let prompt_uses_starship = ($prompt_cmd | str contains "starship' prompt")
|
||||
let right_prompt_uses_starship = ($right_prompt_cmd | str contains "starship' prompt")
|
||||
|
||||
{
|
||||
starship_installed: $installed
|
||||
starship_path: ((which ^starship | get path.0?) | default "<not-found>")
|
||||
starship_version: (if $installed { (^starship --version | str trim) } else { "<not-installed>" })
|
||||
STARSHIP_SHELL: ($env.STARSHIP_SHELL? | default "<not-set>")
|
||||
STARSHIP_CONFIG: ($env.STARSHIP_CONFIG? | default "<not-set>")
|
||||
prompt_command_type: $prompt_type
|
||||
prompt_command_uses_starship: $prompt_uses_starship
|
||||
prompt_command_right_type: $right_prompt_type
|
||||
prompt_command_right_uses_starship: $right_prompt_uses_starship
|
||||
}
|
||||
}
|
||||
|
||||
export-env {
|
||||
if (which ^starship | is-not-empty) {
|
||||
$env.STARSHIP_SHELL = "nu"
|
||||
@@ -51,6 +74,7 @@ export-env {
|
||||
)
|
||||
}
|
||||
}
|
||||
$env.starship_config = ($env.NU_POLYJUICE_PATH | path join ".." "starship" $"starship_default.toml")
|
||||
let default_cfg = ($env.NU_POLYJUICE_PATH | path join ".." "starship" $"starship_default.toml")
|
||||
$env.STARSHIP_CONFIG = $default_cfg
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user