Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fish shell] The prompt do not update when using set -gx change enviroment variable #5888

Open
ekil1100 opened this issue Mar 27, 2024 · 1 comment
Labels
🐛 bug Something isn't working as expected.

Comments

@ekil1100
Copy link

Bug Report

Current Behavior

  1. set a custom command
command = '''
if test "$OHOS_DEBUG" = "true"; 
    echo (basename $OHOS_PATH) "debug"; 
else; 
    echo (basename $OHOS_PATH) "release"; 
end
'''
when = "true"
format = "on [$symbol($output )]($style)"
  1. run set -gx OHOS_DEBUG false
  2. the prompt do not update to xxxxx release

Expected Behavior

the prompt should update to xxxxx release

Additional context/Screenshots

Possible Solution

Environment

  • Starship version: starship 1.18.0
  • Shell type: fish
  • Shell version: fish, version 3.7.1
  • Shell plugin manager: none
  • Terminal emulator: windows terminal
  • Operating system: Windows wsl ubuntu 22.04

Relevant Shell Configuration

set fish_greeting

set -U fish_user_paths $fish_user_paths /home/linuxbrew/.linuxbrew/bin
set -U fish_user_paths $fish_user_paths $HOME/chrome/depot_tools
set -U fish_user_paths $fish_user_paths $HOME/.local/bin
set -U fish_user_paths $fish_user_paths $HOME/ohos/tools
ark init fish | source

if status is-interactive
    export STARSHIP_LOG="error"
    starship init fish | source
    zoxide init --cmd j fish | source
end

ark init fish produce following config

set -gx OHOS_PATH "$HOME/ohos/standalone"
set -gx OHOS_STANDALONE true
set -gx OHOS_DEBUG true

function change_ohos_path
    set -gx OHOS_PATH "$HOME/ohos/$argv[1]"
    echo "OHOS_PATH: $OHOS_PATH"
end

function ohos
    if test $OHOS_STANDALONE = false
        set -gx OHOS_STANDALONE true
        change_ohos_path standalone
    else
        set -gx OHOS_STANDALONE false
        change_ohos_path main
    end
    echo "OHOS_STANDALONE: $OHOS_STANDALONE"
end

function debug
    if test $OHOS_DEBUG = false
        set -gx OHOS_DEBUG true
    else
        set -gx OHOS_DEBUG false
    end
    echo "OHOS_DEBUG: $OHOS_DEBUG"
end

Starship Configuration

# Set whatever time out in ms
command_timeout = 500

[custom.ohos]
command = '''
if test "$OHOS_DEBUG" = "true"; 
    echo (basename $OHOS_PATH) "debug"; 
else; 
    echo (basename $OHOS_PATH) "release"; 
end
'''
when = "true"
format = "on [$symbol($output )]($style)"

[character]
success_symbol = "[>](bold green)"
error_symbol = "[x](bold red)"
vimcmd_symbol = "[<](bold green)"

[git_commit]
tag_symbol = " tag "

[git_status]
ahead = ">"
behind = "<"
diverged = "<>"
renamed = "r"
deleted = "x"

[aws]
symbol = "aws "

[azure]
symbol = "az "

[bun]
symbol = "bun "

[c]
symbol = "C "

[cobol]
symbol = "cobol "

[conda]
symbol = "conda "

[crystal]
symbol = "cr "

[cmake]
symbol = "cmake "

[daml]
symbol = "daml "

[dart]
symbol = "dart "

[deno]
symbol = "deno "

[dotnet]
symbol = ".NET "

[directory]
truncation_length = 5
truncate_to_repo = false
read_only = " ro"

[docker_context]
symbol = "docker "

[elixir]
symbol = "exs "

[elm]
symbol = "elm "

[fennel]
symbol = "fnl "

[fossil_branch]
symbol = "fossil "

[gcloud]
symbol = "gcp "

[git_branch]
always_show_remote = true
format = "on [($remote_name/)$branch]($style) "

[golang]
symbol = "go "

[gradle]
symbol = "gradle "

[guix_shell]
symbol = "guix "

[hg_branch]
symbol = "hg "

[java]
symbol = "java "

[julia]
symbol = "jl "

[kotlin]
symbol = "kt "

[lua]
symbol = "lua "

[nodejs]
symbol = "nodejs "

[memory_usage]
symbol = "memory "

[meson]
symbol = "meson "

[nim]
symbol = "nim "

[nix_shell]
symbol = "nix "

[ocaml]
symbol = "ml "

[opa]
symbol = "opa "

[os.symbols]
Alpaquita = "alq "
Alpine = "alp "
Amazon = "amz "
Android = "andr "
Arch = "rch "
Artix = "atx "
CentOS = "cent "
Debian = "deb "
DragonFly = "dfbsd "
Emscripten = "emsc "
EndeavourOS = "ndev "
Fedora = "fed "
FreeBSD = "fbsd "
Garuda = "garu "
Gentoo = "gent "
HardenedBSD = "hbsd "
Illumos = "lum "
Linux = "lnx "
Mabox = "mbox "
Macos = "mac "
Manjaro = "mjo "
Mariner = "mrn "
MidnightBSD = "mid "
Mint = "mint "
NetBSD = "nbsd "
NixOS = "nix "
OpenBSD = "obsd "
OpenCloudOS = "ocos "
openEuler = "oeul "
openSUSE = "osuse "
OracleLinux = "orac "
Pop = "pop "
Raspbian = "rasp "
Redhat = "rhl "
RedHatEnterprise = "rhel "
Redox = "redox "
Solus = "sol "
SUSE = "suse "
Ubuntu = "ubnt "
Unknown = "unk "
Windows = "win "

[package]
symbol = "pkg "

[perl]
symbol = "pl "

[php]
symbol = "php "

[pijul_channel]
symbol = "pijul "

[pulumi]
symbol = "pulumi "

[purescript]
symbol = "purs "

[python]
symbol = "py "

[raku]
symbol = "raku "

[ruby]
symbol = "rb "

[rust]
symbol = "rs "

[scala]
symbol = "scala "

[spack]
symbol = "spack "

[solidity]
symbol = "solidity "

[status]
symbol = "[x](bold red) "

[sudo]
symbol = "sudo "

[swift]
symbol = "swift "

[terraform]
symbol = "terraform "

[zig]
symbol = "zig "
@ekil1100 ekil1100 added the 🐛 bug Something isn't working as expected. label Mar 27, 2024
@ekil1100
Copy link
Author

I digged in, find out the starship is running on a different fish shell instance. so the set -gx is not take effect.

Is there other way to achieving the same functionality or grep the right environment?

@andytom

@ekil1100 ekil1100 changed the title The prompt do not update when using set -gx change enviroment variable [fish shell] The prompt do not update when using set -gx change enviroment variable Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

1 participant