-
-
Save fitrh/f8c70203e3bca142d52a585e34f0248d to your computer and use it in GitHub Desktop.
| format = """ | |
| $username\ | |
| $kubernetes\ | |
| $directory\ | |
| ${custom.git_host}\ | |
| $git_branch\ | |
| $git_commit\ | |
| $git_state\ | |
| $git_status\ | |
| $hg_branch\ | |
| $docker_context\ | |
| $package\ | |
| $cmake\ | |
| $dart\ | |
| $deno\ | |
| $dotnet\ | |
| $elixir\ | |
| $elm\ | |
| $erlang\ | |
| $golang\ | |
| $helm\ | |
| $java\ | |
| $julia\ | |
| $kotlin\ | |
| $nim\ | |
| $nodejs\ | |
| $ocaml\ | |
| $perl\ | |
| $php\ | |
| $purescript\ | |
| $python\ | |
| $red\ | |
| $ruby\ | |
| $rust\ | |
| $swift\ | |
| $terraform\ | |
| $vlang\ | |
| $vagrant\ | |
| $zig\ | |
| $nix_shell\ | |
| $conda\ | |
| $aws\ | |
| $gcloud\ | |
| $openstack\ | |
| $env_var\ | |
| $crystal\ | |
| $custom\ | |
| $cmd_duration\ | |
| $lua\ | |
| $line_break\ | |
| $jobs\ | |
| $character""" | |
| scan_timeout = 10 | |
| add_newline = false | |
| [battery] | |
| disabled = true | |
| [character] | |
| success_symbol = "[](blue)" | |
| error_symbol = "[](bright-red)" | |
| [cmd_duration] | |
| show_notifications = true | |
| min_time_to_notify = 60_000 | |
| [directory] | |
| truncation_length = 1 | |
| format = "[](blue) [$path]($style)[$read_only]($read_only_style)" | |
| read_only = " " | |
| truncation_symbol = "" | |
| fish_style_pwd_dir_length = 0 | |
| [git_branch] | |
| format = ":[$symbol$branch]($style)" | |
| symbol = " " | |
| [git_state] | |
| format = '\(:[$state( $progress_current/$progress_total)]($style)\)' | |
| [git_status] | |
| format = '(:[$all_status$ahead_behind]($style)) ' | |
| conflicted = '\[ [$count](bright-white bold)\]' | |
| ahead = '\[[﯁ ](bright-blue)[$count](bright-white bold)\]' | |
| behind = '\[[﮾ ](white)[$count](bright-white bold)\]' | |
| diverged = '\[[ ](purple)|[ ﯁ ](bright-blue)[$ahead_count](bright-white bold)[ ﮾ ](white)[$behind_count](bright-white)\]' | |
| untracked = '\[ [$count](bright-white bold)\]' | |
| stashed = '\[[](yellow) [$count](bright-white bold)\]' | |
| modified = '\[[ ](bright-yellow)[$count](bright-white bold)\]' | |
| staged = '\[[ ](bright-green)[$count](bright-white bold)\]' | |
| renamed = '\[[ ](bright-cyan) [$count](bright-white bold)\]' | |
| deleted = '\[ [$count](bright-white bold)\]' | |
| [python] | |
| format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)' | |
| [custom.git_host] | |
| command = """ | |
| URL=$(command git ls-remote --get-url 2> /dev/null) | |
| if [[ "$URL" =~ "github" ]]; then | |
| ICON=" " | |
| elif [[ "$URL" =~ "gitlab" ]]; then | |
| ICON=" " | |
| elif [[ "$URL" =~ "bitbucket" ]];then | |
| ICON=" " | |
| elif [[ "$URL" =~ "kernel" ]];then | |
| ICON=" " | |
| elif [[ "$URL" =~ "archlinux" ]];then | |
| ICON=" " | |
| elif [[ "$URL" =~ "gnu" ]];then | |
| ICON=" " | |
| elif [[ "$URL" =~ "git" ]];then | |
| ICON=" " | |
| else | |
| ICON=" " | |
| URL="localhost" | |
| fi | |
| for PATTERN in "https" "http" "git" "://" "@"; do | |
| [[ "$URL" == "$PATTERN"* ]] && URL="${URL##$PATTERN}" | |
| done | |
| for PATTERN in "/" ".git"; do | |
| [[ "$URL" == *"$PATTERN" ]] && URL="${URL%%$PATTERN}" | |
| done | |
| printf "%s%s" "$ICON" "$URL" | |
| """ | |
| directories = [".git"] | |
| when = 'git rev-parse --is-inside-work-tree 2> /dev/null' | |
| shell = ["bash","--norc","--noprofile"] | |
| style = "bright-yellow bold" | |
| format = " at [$output]($style)" | |
| [hostname] | |
| disabled = true |
ghost
commented
Jun 27, 2021
via email
@backermanbd there is no "first", because the only thing that get executed is what inside command variable, and you can not have multiple command for a custom module
@j0k4rX just take the
commandvalue into a bash file, make the file executable, and put the file into a directory inside your$PATH(so you can call it everywhere from your shell) or where ever you like, then change thecommandvalue to the path of your script.
For me, i created a bash script calledgetgithostand put it inside~/.local/script, so my command variable look like this
command = "~/.local/script/getgithost"
@fitrh can you be more specific?
should i add this line in .bashrc
command = "~/.local/script/getgithost"
and the getgithost is the file name or getgithost.bashrc something like this under ~/.local/script
should i add this line in .bashrc
command = "~/.local/script/getgithost"
no, it's for your starship config
and the
getgithostis the file name or getgithost.bashrc something like this under~/.local/script
just the getgithost
replace this
[custom.git_host]
command = """
URL=$(command git ls-remote --get-url 2> /dev/null)
if [[ "$URL" =~ "github" ]]; then
ICON=" "
elif [[ "$URL" =~ "gitlab" ]]; then
ICON=" "
elif [[ "$URL" =~ "bitbucket" ]];then
ICON=" "
elif [[ "$URL" =~ "kernel" ]];then
ICON=" "
elif [[ "$URL" =~ "archlinux" ]];then
ICON=" "
elif [[ "$URL" =~ "gnu" ]];then
ICON=" "
elif [[ "$URL" =~ "git" ]];then
ICON=" "
else
ICON=" "
URL="localhost"
fi
for PATTERN in "https" "http" "git" "://" "@"; do
[[ "$URL" == "$PATTERN"* ]] && URL="${URL##$PATTERN}"
done
for PATTERN in "/" ".git"; do
[[ "$URL" == *"$PATTERN" ]] && URL="${URL%%$PATTERN}"
done
printf "%s%s" "$ICON" "$URL"
"""with this
[custom.git_host]
command = "path/to/your/script"got it