Initial commit
This commit is contained in:
commit
efb336a23b
38
.bashrc
Normal file
38
.bashrc
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# ~/.bashrc
|
||||
#
|
||||
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
colors() {
|
||||
local fgc bgc vals seq0
|
||||
|
||||
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
|
||||
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
|
||||
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
|
||||
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
|
||||
|
||||
# foreground colors
|
||||
for fgc in {30..37}; do
|
||||
# background colors
|
||||
for bgc in {40..47}; do
|
||||
fgc=${fgc#37} # white
|
||||
bgc=${bgc#40} # black
|
||||
|
||||
vals="${fgc:+$fgc;}${bgc}"
|
||||
vals=${vals%%;}
|
||||
|
||||
seq0="${vals:+\e[${vals}m}"
|
||||
printf " %-9s" "${seq0:-(default)}"
|
||||
printf " ${seq0}TEXT\e[m"
|
||||
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
|
||||
done
|
||||
echo; echo
|
||||
done
|
||||
}
|
||||
|
||||
[[ -f ~/.extend.bashrc ]] && . ~/.extend.bashrc
|
||||
|
||||
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
|
||||
|
||||
export TERM=xterm-256color
|
116
.config/conky/litecrc
Normal file
116
.config/conky/litecrc
Normal file
@ -0,0 +1,116 @@
|
||||
#Text Color
|
||||
color1 D9D9D9
|
||||
#Icons Color
|
||||
color2 75D85A
|
||||
#Graph Color
|
||||
color3 75D85A
|
||||
|
||||
own_window_argb_visual yes
|
||||
update_interval 1
|
||||
double_buffer yes
|
||||
imlib_cache_size 10
|
||||
own_window true
|
||||
own_window_type override
|
||||
own_window_class Conky
|
||||
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
|
||||
own_window_transparent no
|
||||
own_window_argb_value 192
|
||||
own_window_transparent yes
|
||||
double_buffer yes
|
||||
minimum_size 330 1000
|
||||
border_inner_margin 0
|
||||
border_outer_margin 0
|
||||
alignment top_right
|
||||
gap_x 0
|
||||
gap_y 0
|
||||
background yes
|
||||
use_xft yes
|
||||
font Noto Sans:size=9
|
||||
text_buffer_size 256
|
||||
draw_shades bo
|
||||
override_utf8_locale yes
|
||||
draw_graph_borders no
|
||||
default_color FFFFFF
|
||||
|
||||
TEXT
|
||||
|
||||
|
||||
|
||||
${alignc}${color3}${font Monospace:style=Bold:pixelsize=90}${time %H:%M:%S}${font}${color}
|
||||
|
||||
${alignc}${font Monospace:style=Bold:pixelsize=32}${time %A},${time %e} de ${time %B}, ${time %G}${font}
|
||||
${voffset 10}$color1
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}M $font$color1 ${sysname} ${kernel} - ${machine}
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}G $font$color1 Uptime: ${uptime}
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}Q $font$color1 Running Processes: ${running_processes} / ${processes}
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}D $font$color1 Desktop: ${if_match "$desktop"!="Not running in X"}(${desktop}/${desktop_number})${endif}: ${desktop_name}
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}7 $font$color1 Threads: ${running_threads}
|
||||
${goto 20}$color2${font LineAwesomeMod :size=12}y $font$color1 Battery: ${battery BAT0} ${alignr 30}Charge: ${battery_percent BAT0}%
|
||||
${hr 2}
|
||||
\
|
||||
|
||||
# Usage
|
||||
Usage
|
||||
${voffset 20}
|
||||
${goto 40}${cpugraph 26,190 FFFFFF FFFFFF -l}
|
||||
${goto 40}CPU:${alignr 39}${cpu}%
|
||||
|
||||
${goto 40}${memgraph 26,190 FFFFFF FFFFFF -l}
|
||||
${goto 40}Mem:${alignr 39}${memperc}%
|
||||
${alignr 39}${mem}
|
||||
|
||||
${goto 40}${diskiograph 26,190 FFFFFF FFFFFF -l}
|
||||
${goto 40}Disk I/O:${alignr 39}${diskio}
|
||||
|
||||
${hr 2}
|
||||
\
|
||||
|
||||
# Network
|
||||
\
|
||||
Network
|
||||
|
||||
${goto 40}${upspeedgraph wlp2s0 26,80 FFFFFF FFFFFF}${goto 275}${downspeedgraph wlp2s0 26,80 FFFFFF FFFFFF}
|
||||
${goto 40}${color5}Up: ${color2}${upspeed wlp2s0}${color5}${goto 275}Down: ${color2}${downspeed wlp2s0}
|
||||
${goto 40}${color5}Sent: ${color2}${totalup wlp2s0}${color5}${goto 275}Received: ${color2}${totaldown wlp2s0}
|
||||
|
||||
${goto 40}$color2${font LineAwesomeMod :size=12}= $font$color1 Local IP ${alignr 30}${addr wlp2s0}
|
||||
${goto 40}$color2${font LineAwesomeMod :size=12}= $font$color1 Public IP ${alignr 30}${execi 60 curl ipinfo.io/ip}
|
||||
${goto 40}$color2${font LineAwesomeMod :size=12}T $font$color1 Upload Speed${alignr 30}${upspeed wlp2s0}
|
||||
${goto 40}$color2${font LineAwesomeMod :size=12}8 $font$color1 Download Speed${alignr 30}${downspeed wlp2s0}
|
||||
${goto 40}$color2${font LineAwesomeMod :size=12}f $font$color1 Ping: ${color1}${execi 1 sh -c 'ping 1.1.1.1 -c 1 | grep -Po "(?<=time=)(.*?)s"'}\
|
||||
|
||||
|
||||
${hr 2}
|
||||
\
|
||||
|
||||
# Proceses
|
||||
\
|
||||
Proceses
|
||||
|
||||
${goto 40}${color1}Process${color}${alignr 39}${color1}${color1}Mem${color}
|
||||
${goto 40}${color2}${top_mem name 1}${color}${alignr 39}${top_mem mem_res 1}
|
||||
${goto 40}${color2}${top_mem name 2}${color}${alignr 39}${top_mem mem_res 2}
|
||||
${goto 40}${color2}${top_mem name 3}${color}${alignr 39}${top_mem mem_res 3}
|
||||
${goto 40}${color2}${top_mem name 4}${color}${alignr 39}${top_mem mem_res 4}
|
||||
${goto 40}${color2}${top_mem name 5}${color}${alignr 39}${top_mem mem_res 5}
|
||||
|
||||
${goto 40}${color1}Process${color}${alignr 39}${color1}Cpu %${color}
|
||||
${goto 40}${color2}${top_mem name 1}${color}${alignr 39}${top cpu 1} %
|
||||
${goto 40}${color2}${top_mem name 2}${color}${alignr 39}${top cpu 2} %
|
||||
${goto 40}${color2}${top_mem name 3}${color}${alignr 39}${top cpu 3} %
|
||||
${goto 40}${color2}${top_mem name 4}${color}${alignr 39}${top cpu 4} %
|
||||
${goto 40}${color2}${top_mem name 5}${color}${alignr 39}${top cpu 5} %
|
||||
${hr 2}
|
||||
|
||||
\
|
||||
Weather
|
||||
|
||||
$color1${execi 3600 ~/.conky/weather.py}
|
||||
${goto 20}${color2}${font LineAwesomeMod :size=12}V $color1$font ${execi 60 cat ~/.cache/weather.txt | grep city | cut -d">" -f2} - ${execi 60 cat ~/.cache/weather.txt | grep country | cut -d">" -f2}
|
||||
${goto 20}${color2}${font LineAwesomeMod :size=12}O $color1$font ${execi 60 cat ~/.cache/weather.txt | grep description | cut -d">" -f2} ${alignr 30}${execi 60 cat ~/.cache/weather.txt | grep temp | cut -d">" -f2}ºC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
o
|
6
.config/conky/start.sh
Executable file
6
.config/conky/start.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
~/.config/conky/weather.py &
|
||||
conky -q -c ~/.config/conky/litecrc
|
||||
|
||||
exit
|
||||
|
51
.config/conky/weather.py
Executable file
51
.config/conky/weather.py
Executable file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import urllib.request
|
||||
import json
|
||||
import datetime
|
||||
from pathlib import Path
|
||||
|
||||
########################################################
|
||||
# CONFIGURATION
|
||||
########################################################
|
||||
# UNITY = f for fahrenheit, c for celsius or k for kelvin
|
||||
# API_KEY = free register in https://openweathermap.org
|
||||
# and get your token
|
||||
# CITY = your city name
|
||||
# COUNTRY = your country abbreviation: us, ru, br, etc..
|
||||
########################################################
|
||||
|
||||
UNITY = "c"
|
||||
API_KEY = "b91400ad90f74c8cc0bccf5e2978aaca"
|
||||
CITY = "Montevideo"
|
||||
COUNTRY = "uy"
|
||||
|
||||
########################################################
|
||||
main_url = "http://api.openweathermap.org/data/2.5/weather?"
|
||||
url = main_url+"APPID={}&q={},{}".format(API_KEY,CITY,COUNTRY)
|
||||
print(url)
|
||||
metrics = {"k":"&units=default","c":"&units=metric","f":"&units=imperial"}
|
||||
for key,value in metrics.items():
|
||||
if UNITY == key:
|
||||
url += value
|
||||
request = urllib.request.urlopen(url)
|
||||
if request.status != 200:
|
||||
exit(0)
|
||||
response = request.read()
|
||||
|
||||
j = json.loads(response.decode("utf-8"))
|
||||
home = str(Path.home())
|
||||
weather = open(home+"/.cache/weather.txt",'w+')
|
||||
weather.write("city>"+j["name"]+"\n")
|
||||
weather.write("country>"+j["sys"]["country"]+"\n")
|
||||
weather.write("temp>"+str(j["main"]["temp"])+"\n")
|
||||
weather.write("description>"+j["weather"][0]["description"].capitalize()+"\n")
|
||||
weather.write("min>"+str(j["main"]["temp_min"])+"\n")
|
||||
weather.write("max>"+str(j["main"]["temp_max"])+"\n")
|
||||
weather.write("humidity>"+str(j["main"]["humidity"])+"\n")
|
||||
weather.write("pressure>"+str(j["main"]["pressure"])+"\n")
|
||||
weather.write("wind>"+str(j["wind"]["speed"])+"\n")
|
||||
weather.write("update>"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+"\n")
|
||||
|
||||
weather.close()
|
2
.config/fish/.gitignore
vendored
Normal file
2
.config/fish/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
fish_history
|
||||
personal_abbr.fish
|
13
.config/fish/README.md
Normal file
13
.config/fish/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# fish_dotfiles
|
||||
|
||||
This are my fish dotfiles.
|
||||
|
||||
## How it looks
|
||||

|
||||
|
||||
|
||||
## Uses
|
||||
- [Fisher](https://github.com/jorgebucaran/fisher)
|
||||
- [Oh my fish!](https://github.com/oh-my-fish/oh-my-fish)
|
||||
- [Bobthefish](https://github.com/oh-my-fish/theme-bobthefish)
|
||||
- My own abbreviations
|
85
.config/fish/abbreviations.fish
Normal file
85
.config/fish/abbreviations.fish
Normal file
@ -0,0 +1,85 @@
|
||||
# Update Arch
|
||||
abbr i 'sudo pacman -S'
|
||||
abbr r 'sudo pacman -R'
|
||||
abbr u 'sudo pacman -Syu'
|
||||
|
||||
# Git
|
||||
abbr g 'git'
|
||||
abbr ga. 'git add .'
|
||||
abbr ga 'git add'
|
||||
abbr gb 'git branch'
|
||||
abbr gbd 'git branch -D'
|
||||
abbr gcm 'git commit -m'
|
||||
abbr gco 'git checkout'
|
||||
abbr gcob 'git checkout -b'
|
||||
abbr gcod 'git checkout development'
|
||||
abbr gi 'gitignore'
|
||||
abbr gm 'git merge'
|
||||
abbr gpl 'git pull'
|
||||
abbr gps 'git push'
|
||||
abbr gpsu 'git push -u origin master'
|
||||
abbr gs 'git status'
|
||||
abbr gc 'git clone'
|
||||
abbr gd 'git diff'
|
||||
abbr gcd 'git checkout develop'
|
||||
abbr gpd 'git pull origin develop'
|
||||
abbr gst 'git stash'
|
||||
abbr gsta 'git stash apply'
|
||||
|
||||
# <a href="https://github.com/petervanderdoes/gitflow-avh">Git Flow AVH</a>
|
||||
abbr gf 'git flow'
|
||||
abbr gfi 'git flow init -d'
|
||||
|
||||
abbr gff 'git flow feature'
|
||||
abbr gffs 'git flow feature start'
|
||||
abbr gfff 'git flow feature finish'
|
||||
abbr gffp 'git flow feature publish'
|
||||
abbr gfft 'git flow feature track'
|
||||
abbr gffco 'git flow feature checkout'
|
||||
|
||||
abbr gfr 'git flow release'
|
||||
abbr gfrs 'git flow release start'
|
||||
abbr gfrf 'git flow release finish'
|
||||
abbr gfrp 'git flow release publish'
|
||||
abbr gfrt 'git flow release track'
|
||||
abbr gfrco 'git flow release checkout'
|
||||
|
||||
abbr gfb 'git flow bugfix'
|
||||
abbr gfbs 'git flow bugfix start'
|
||||
abbr gfbf 'git flow bugfix finish'
|
||||
abbr gfbp 'git flow bugfix publish'
|
||||
abbr gfbt 'git flow bugfix track'
|
||||
abbr gfbco 'git flow bugfix checkout'
|
||||
|
||||
abbr gfh 'git flow hotfix'
|
||||
abbr gfhs 'git flow hotfix start'
|
||||
abbr gfhf 'git flow hotfix finish'
|
||||
abbr gfhp 'git flow hotfix publish'
|
||||
abbr gfht 'git flow hotfix track'
|
||||
abbr gfhco 'git flow hotfix checkout'
|
||||
|
||||
# LS
|
||||
abbr l 'ls'
|
||||
|
||||
# NPM
|
||||
abbr ni 'npm install'
|
||||
abbr nis 'npm install --save'
|
||||
abbr nisd 'npm install --save-dev'
|
||||
abbr nig 'npm install -g'
|
||||
abbr np 'npm prune'
|
||||
abbr nl 'npm list'
|
||||
abbr nr 'npm remove'
|
||||
abbr nu 'npm update'
|
||||
abbr ns 'npm start'
|
||||
abbr nt 'npm test'
|
||||
|
||||
# RM
|
||||
abbr rmr 'rm -r'
|
||||
abbr rmrf 'rm -rf'
|
||||
|
||||
# Tar
|
||||
abbr tc 'tar czvf'
|
||||
abbr tx 'tar xzvf'
|
||||
|
||||
# Other
|
||||
abbr pr 'ping rogs.me'
|
1
.config/fish/completions/fisher.fish
Normal file
1
.config/fish/completions/fisher.fish
Normal file
@ -0,0 +1 @@
|
||||
fisher complete
|
7
.config/fish/conf.d/omf.fish
Normal file
7
.config/fish/conf.d/omf.fish
Normal file
@ -0,0 +1,7 @@
|
||||
# Path to Oh My Fish install.
|
||||
set -q XDG_DATA_HOME
|
||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||
|
||||
# Load Oh My Fish configuration.
|
||||
source $OMF_PATH/init.fish
|
11
.config/fish/config.fish
Normal file
11
.config/fish/config.fish
Normal file
@ -0,0 +1,11 @@
|
||||
set fish_greeting ""
|
||||
set -gx PATH /home/roger/.gem/ruby/2.5.0/bin $PATH
|
||||
set -g theme_powerline_fonts yes
|
||||
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
|
||||
set -g theme_color_scheme dark
|
||||
set -g theme_display_date no
|
||||
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
|
||||
alias rm='rm -i'
|
||||
|
||||
source "$HOME/.config/fish/abbreviations.fish"
|
||||
source "$HOME/.config/fish/personal_abbr.fish"
|
104
.config/fish/fish_variables
Normal file
104
.config/fish/fish_variables
Normal file
@ -0,0 +1,104 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __fish_classic_git_prompt_initialized:\x1d
|
||||
SETUVAR __fish_init_1_50_0:\x1d
|
||||
SETUVAR __fish_init_2_39_8:\x1d
|
||||
SETUVAR __fish_init_2_3_0:\x1d
|
||||
SETUVAR __fish_init_3_x:\x1d
|
||||
SETUVAR _fish_abbr_cdccb:cd\x20\x7e/code/massive/cocacola/new\x2dbackend
|
||||
SETUVAR _fish_abbr_cdccf:cd\x20\x7e/code/massive/cocacola/frontend
|
||||
SETUVAR _fish_abbr_cdimb:cd\x20\x7e/code/personal/identidadMisional/backend
|
||||
SETUVAR _fish_abbr_g:git
|
||||
SETUVAR _fish_abbr_ga:git\x20add
|
||||
SETUVAR _fish_abbr_ga_2E_:git\x20add\x20\x2e
|
||||
SETUVAR _fish_abbr_gb:git\x20branch
|
||||
SETUVAR _fish_abbr_gbd:git\x20branch\x20\x2dD
|
||||
SETUVAR _fish_abbr_gc:git\x20clone
|
||||
SETUVAR _fish_abbr_gcd:git\x20checkout\x20develop
|
||||
SETUVAR _fish_abbr_gcm:git\x20commit\x20\x2dm
|
||||
SETUVAR _fish_abbr_gco:git\x20checkout
|
||||
SETUVAR _fish_abbr_gcob:git\x20checkout\x20\x2db
|
||||
SETUVAR _fish_abbr_gcod:git\x20checkout\x20development
|
||||
SETUVAR _fish_abbr_gd:git\x20diff
|
||||
SETUVAR _fish_abbr_gf:git\x20flow
|
||||
SETUVAR _fish_abbr_gfb:git\x20flow\x20bugfix
|
||||
SETUVAR _fish_abbr_gfbco:git\x20flow\x20bugfix\x20checkout
|
||||
SETUVAR _fish_abbr_gfbf:git\x20flow\x20bugfix\x20finish
|
||||
SETUVAR _fish_abbr_gfbp:git\x20flow\x20bugfix\x20publish
|
||||
SETUVAR _fish_abbr_gfbs:git\x20flow\x20bugfix\x20start
|
||||
SETUVAR _fish_abbr_gfbt:git\x20flow\x20bugfix\x20track
|
||||
SETUVAR _fish_abbr_gff:git\x20flow\x20feature
|
||||
SETUVAR _fish_abbr_gffco:git\x20flow\x20feature\x20checkout
|
||||
SETUVAR _fish_abbr_gfff:git\x20flow\x20feature\x20finish
|
||||
SETUVAR _fish_abbr_gffp:git\x20flow\x20feature\x20publish
|
||||
SETUVAR _fish_abbr_gffs:git\x20flow\x20feature\x20start
|
||||
SETUVAR _fish_abbr_gfft:git\x20flow\x20feature\x20track
|
||||
SETUVAR _fish_abbr_gfh:git\x20flow\x20hotfix
|
||||
SETUVAR _fish_abbr_gfhco:git\x20flow\x20hotfix\x20checkout
|
||||
SETUVAR _fish_abbr_gfhf:git\x20flow\x20hotfix\x20finish
|
||||
SETUVAR _fish_abbr_gfhp:git\x20flow\x20hotfix\x20publish
|
||||
SETUVAR _fish_abbr_gfhs:git\x20flow\x20hotfix\x20start
|
||||
SETUVAR _fish_abbr_gfht:git\x20flow\x20hotfix\x20track
|
||||
SETUVAR _fish_abbr_gfi:git\x20flow\x20init\x20\x2dd
|
||||
SETUVAR _fish_abbr_gfr:git\x20flow\x20release
|
||||
SETUVAR _fish_abbr_gfrco:git\x20flow\x20release\x20checkout
|
||||
SETUVAR _fish_abbr_gfrf:git\x20flow\x20release\x20finish
|
||||
SETUVAR _fish_abbr_gfrp:git\x20flow\x20release\x20publish
|
||||
SETUVAR _fish_abbr_gfrs:git\x20flow\x20release\x20start
|
||||
SETUVAR _fish_abbr_gfrt:git\x20flow\x20release\x20track
|
||||
SETUVAR _fish_abbr_gi:gitignore
|
||||
SETUVAR _fish_abbr_gm:git\x20merge
|
||||
SETUVAR _fish_abbr_gpd:git\x20pull\x20origin\x20develop
|
||||
SETUVAR _fish_abbr_gpl:git\x20pull
|
||||
SETUVAR _fish_abbr_gps:git\x20push
|
||||
SETUVAR _fish_abbr_gpsu:git\x20push\x20\x2du\x20origin\x20master
|
||||
SETUVAR _fish_abbr_gs:git\x20status
|
||||
SETUVAR _fish_abbr_gst:git\x20stash
|
||||
SETUVAR _fish_abbr_gsta:git\x20stash\x20apply
|
||||
SETUVAR _fish_abbr_i:sudo\x20pacman\x20\x2dS
|
||||
SETUVAR _fish_abbr_l:ls
|
||||
SETUVAR _fish_abbr_ni:npm\x20install
|
||||
SETUVAR _fish_abbr_nig:npm\x20install\x20\x2dg
|
||||
SETUVAR _fish_abbr_nis:npm\x20install\x20\x2d\x2dsave
|
||||
SETUVAR _fish_abbr_nisd:npm\x20install\x20\x2d\x2dsave\x2ddev
|
||||
SETUVAR _fish_abbr_nl:npm\x20list
|
||||
SETUVAR _fish_abbr_np:npm\x20prune
|
||||
SETUVAR _fish_abbr_nr:npm\x20remove
|
||||
SETUVAR _fish_abbr_ns:npm\x20start
|
||||
SETUVAR _fish_abbr_nt:npm\x20test
|
||||
SETUVAR _fish_abbr_nu:npm\x20update
|
||||
SETUVAR _fish_abbr_pr:ping\x20rogs\x2eme
|
||||
SETUVAR _fish_abbr_r:sudo\x20pacman\x20\x2dR
|
||||
SETUVAR _fish_abbr_rmr:rm\x20\x2dr
|
||||
SETUVAR _fish_abbr_rmrf:rm\x20\x2drf
|
||||
SETUVAR _fish_abbr_tc:tar\x20czvf
|
||||
SETUVAR _fish_abbr_tx:tar\x20xzvf
|
||||
SETUVAR _fish_abbr_u:sudo\x20pacman\x20\x2dSyu
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:005fd7
|
||||
SETUVAR fish_color_comment:990000
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:009900
|
||||
SETUVAR fish_color_error:ff0000
|
||||
SETUVAR fish_color_escape:00a6b2
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:00a6b2
|
||||
SETUVAR fish_color_param:00afff
|
||||
SETUVAR fish_color_quote:999900
|
||||
SETUVAR fish_color_redirection:00afff
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_greeting:
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
33
.config/fish/fishd.roger-pc
Normal file
33
.config/fish/fishd.roger-pc
Normal file
@ -0,0 +1,33 @@
|
||||
# This file is automatically generated by the fish.
|
||||
# Do NOT edit it directly, your changes will be overwritten.
|
||||
SET __fish_classic_git_prompt_initialized:\x1d
|
||||
SET __fish_init_1_50_0:\x1d
|
||||
SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET fish_color_autosuggestion:555\x1eyellow
|
||||
SET fish_color_command:005fd7\x1epurple
|
||||
SET fish_color_comment:red
|
||||
SET fish_color_cwd:green
|
||||
SET fish_color_cwd_root:red
|
||||
SET fish_color_end:brmagenta
|
||||
SET fish_color_error:red\x1e\x2d\x2dbold
|
||||
SET fish_color_escape:cyan
|
||||
SET fish_color_history_current:cyan
|
||||
SET fish_color_host:\x2do\x1ecyan
|
||||
SET fish_color_match:cyan
|
||||
SET fish_color_normal:normal
|
||||
SET fish_color_operator:cyan
|
||||
SET fish_color_param:00afff\x1ecyan
|
||||
SET fish_color_quote:brown
|
||||
SET fish_color_redirection:normal
|
||||
SET fish_color_search_match:\x2d\x2dbackground\x3dpurple
|
||||
SET fish_color_selection:\x2d\x2dbackground\x3dpurple
|
||||
SET fish_color_status:red
|
||||
SET fish_color_user:\x2do\x1egreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:
|
||||
SET fish_key_bindings:fish_default_key_bindings
|
||||
SET fish_pager_color_completion:normal
|
||||
SET fish_pager_color_description:555\x1eyellow
|
||||
SET fish_pager_color_prefix:cyan
|
||||
SET fish_pager_color_progress:cyan
|
2
.config/fish/functions/fish_greeting.fish
Normal file
2
.config/fish/functions/fish_greeting.fish
Normal file
@ -0,0 +1,2 @@
|
||||
# Only to hide the greeting
|
||||
function fish_greeting; end
|
1
.config/fish/functions/fish_prompt.fish
Symbolic link
1
.config/fish/functions/fish_prompt.fish
Symbolic link
@ -0,0 +1 @@
|
||||
/home/roger/.local/share/omf/themes/bobthefish/fish_prompt.fish
|
430
.config/fish/functions/fisher.fish
Normal file
430
.config/fish/functions/fisher.fish
Normal file
@ -0,0 +1,430 @@
|
||||
set -g fisher_version 3.2.9
|
||||
|
||||
function fisher -a cmd -d "fish package manager"
|
||||
set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME ~/.cache
|
||||
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
|
||||
|
||||
set -g fish_config $XDG_CONFIG_HOME/fish
|
||||
set -g fisher_cache $XDG_CACHE_HOME/fisher
|
||||
set -g fisher_config $XDG_CONFIG_HOME/fisher
|
||||
|
||||
set -q fisher_path; or set -g fisher_path $fish_config
|
||||
|
||||
for path in {$fish_config,$fisher_path}/{functions,completions,conf.d} $fisher_cache
|
||||
if test ! -d $path
|
||||
command mkdir -p $path
|
||||
end
|
||||
end
|
||||
|
||||
if test ! -e $fisher_path/completions/fisher.fish
|
||||
echo "fisher complete" >$fisher_path/completions/fisher.fish
|
||||
_fisher_complete
|
||||
end
|
||||
|
||||
if test -e $fisher_path/conf.d/fisher.fish
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
case 2\*
|
||||
case \*
|
||||
command rm -f $fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
else
|
||||
switch "$version"
|
||||
case \*-\*
|
||||
case 2\*
|
||||
echo "fisher copy-user-key-bindings" >$fisher_path/conf.d/fisher.fish
|
||||
end
|
||||
end
|
||||
|
||||
switch "$cmd"
|
||||
case {,self-}complete
|
||||
_fisher_complete
|
||||
case copy-user-key-bindings
|
||||
_fisher_copy_user_key_bindings
|
||||
case ls
|
||||
set -e argv[1]
|
||||
if test -s "$fisher_path/fishfile"
|
||||
set -l file (_fisher_fmt <$fisher_path/fishfile | _fisher_parse -R | command sed "s|@.*||")
|
||||
_fisher_ls | _fisher_fmt | command awk -v FILE="$file" "
|
||||
BEGIN { for (n = split(FILE, f); ++i <= n;) file[f[i]] } \$0 in file && /$argv[1]/
|
||||
" | command sed "s|^$HOME|~|"
|
||||
end
|
||||
case self-update
|
||||
_fisher_self_update (status -f)
|
||||
case self-uninstall
|
||||
_fisher_self_uninstall
|
||||
case {,-}-v{ersion,}
|
||||
echo "fisher version $fisher_version" (status -f | command sed "s|^$HOME|~|")
|
||||
case {,-}-h{elp,}
|
||||
_fisher_help
|
||||
case ""
|
||||
_fisher_commit --
|
||||
case add rm
|
||||
if not isatty
|
||||
while read -l arg
|
||||
set argv $argv $arg
|
||||
end
|
||||
end
|
||||
|
||||
if test (count $argv) = 1
|
||||
echo "fisher: invalid number of arguments" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
_fisher_commit $argv
|
||||
case \*
|
||||
echo "fisher: unknown flag or command \"$cmd\"" >&2
|
||||
_fisher_help >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_complete
|
||||
complete -ec fisher
|
||||
complete -xc fisher -n __fish_use_subcommand -a add -d "Add packages"
|
||||
complete -xc fisher -n __fish_use_subcommand -a rm -d "Remove packages"
|
||||
complete -xc fisher -n __fish_use_subcommand -a ls -d "List installed packages matching REGEX"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --help -d "Show usage help"
|
||||
complete -xc fisher -n __fish_use_subcommand -a --version -d "$fisher_version"
|
||||
complete -xc fisher -n __fish_use_subcommand -a self-update -d "Update to the latest version"
|
||||
for pkg in (fisher ls)
|
||||
complete -xc fisher -n "__fish_seen_subcommand_from rm" -a $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_copy_user_key_bindings
|
||||
if functions -q fish_user_key_bindings
|
||||
functions -c fish_user_key_bindings fish_user_key_bindings_copy
|
||||
end
|
||||
function fish_user_key_bindings
|
||||
for file in $fisher_path/conf.d/*_key_bindings.fish
|
||||
source $file >/dev/null 2>/dev/null
|
||||
end
|
||||
if functions -q fish_user_key_bindings_copy
|
||||
fish_user_key_bindings_copy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_ls
|
||||
for pkg in $fisher_config/*/*/*
|
||||
command readlink $pkg; or echo $pkg
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_fmt
|
||||
command sed "s|^[[:space:]]*||;s|^$fisher_config/||;s|^~|$HOME|;s|^\.\/*|$PWD/|;s|^https*:/*||;s|^github\.com/||;s|/*\$||"
|
||||
end
|
||||
|
||||
function _fisher_help
|
||||
echo "usage: fisher add <package...> Add packages"
|
||||
echo " fisher rm <package...> Remove packages"
|
||||
echo " fisher Update all packages"
|
||||
echo " fisher ls [<regex>] List installed packages matching <regex>"
|
||||
echo " fisher --help Show this help"
|
||||
echo " fisher --version Show the current version"
|
||||
echo " fisher self-update Update to the latest version"
|
||||
echo " fisher self-uninstall Uninstall from your system"
|
||||
echo "examples:"
|
||||
echo " fisher add jethrokuan/z rafaelrinaldi/pure"
|
||||
echo " fisher add gitlab.com/foo/bar@v2"
|
||||
echo " fisher add ~/path/to/local/pkg"
|
||||
echo " fisher add <file"
|
||||
echo " fisher rm rafaelrinaldi/pure"
|
||||
echo " fisher ls | fisher rm"
|
||||
echo " fisher ls fish-\*"
|
||||
end
|
||||
|
||||
function _fisher_self_update -a file
|
||||
set -l url "https://raw.githubusercontent.com/jorgebucaran/fisher/master/fisher.fish"
|
||||
echo "fetching $url" >&2
|
||||
command curl -s "$url?nocache" >$file.
|
||||
|
||||
set -l next_version (command awk '{ print $4 } { exit }' <$file.)
|
||||
switch "$next_version"
|
||||
case "" $fisher_version
|
||||
command rm -f $file.
|
||||
if test -z "$next_version"
|
||||
echo "fisher: cannot update fisher -- are you offline?" >&2
|
||||
return 1
|
||||
end
|
||||
echo "fisher is already up-to-date" >&2
|
||||
case \*
|
||||
echo "linking $file" | command sed "s|$HOME|~|" >&2
|
||||
command mv -f $file. $file
|
||||
source $file
|
||||
echo "updated to fisher $fisher_version -- hooray!" >&2
|
||||
_fisher_complete
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_self_uninstall
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
|
||||
for file in $fisher_cache $fisher_config $fisher_path/{functions,completions,conf.d}/fisher.fish $fisher_path/fishfile
|
||||
echo "removing $file"
|
||||
command rm -Rf $file 2>/dev/null
|
||||
end | command sed "s|$HOME|~|" >&2
|
||||
|
||||
for name in (set -n | command awk '/^fisher_/')
|
||||
set -e "$name"
|
||||
end
|
||||
|
||||
functions -e (functions -a | command awk '/^_fisher/') fisher
|
||||
complete -c fisher --erase
|
||||
end
|
||||
|
||||
function _fisher_commit -a cmd
|
||||
set -e argv[1]
|
||||
set -l elapsed (_fisher_now)
|
||||
set -l fishfile $fisher_path/fishfile
|
||||
|
||||
if test ! -e "$fishfile"
|
||||
command touch $fishfile
|
||||
echo "created new fishfile in $fishfile" | command sed "s|$HOME|~|" >&2
|
||||
end
|
||||
|
||||
set -l old_pkgs (_fisher_ls | _fisher_fmt)
|
||||
for pkg in (_fisher_ls)
|
||||
_fisher_rm $pkg
|
||||
end
|
||||
command rm -Rf $fisher_config
|
||||
command mkdir -p $fisher_config
|
||||
|
||||
set -l next_pkgs (_fisher_fmt <$fishfile | _fisher_parse -R $cmd (printf "%s\n" $argv | _fisher_fmt))
|
||||
set -l actual_pkgs (_fisher_fetch $next_pkgs)
|
||||
set -l updated_pkgs
|
||||
for pkg in $old_pkgs
|
||||
if contains -- $pkg $actual_pkgs
|
||||
set updated_pkgs $updated_pkgs $pkg
|
||||
end
|
||||
end
|
||||
|
||||
if test -z "$actual_pkgs$updated_pkgs$old_pkgs$next_pkgs"
|
||||
echo "fisher: nothing to commit -- try adding some packages" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l out_pkgs
|
||||
if test "$cmd" = "rm"
|
||||
set out_pkgs $next_pkgs
|
||||
else
|
||||
for pkg in $next_pkgs
|
||||
if contains -- (echo $pkg | command sed "s|@.*||") $actual_pkgs
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printf "%s\n" (_fisher_fmt <$fishfile | _fisher_parse -W $cmd $out_pkgs | command sed "s|^$HOME|~|") >$fishfile
|
||||
|
||||
_fisher_complete
|
||||
|
||||
command awk -v A=(count $actual_pkgs) -v U=(count $updated_pkgs) -v O=(count $old_pkgs) -v E=(_fisher_now $elapsed) '
|
||||
BEGIN {
|
||||
res = fmt("removed", O - U, fmt("updated", U, fmt("added", A - U)))
|
||||
printf((res ? res : "done") " in %.2fs\n", E / 1000)
|
||||
}
|
||||
function fmt(action, n, s) {
|
||||
return n ? (s ? s ", " : s) action " " n " package" (n > 1 ? "s" : "") : s
|
||||
}
|
||||
' >&2
|
||||
end
|
||||
|
||||
function _fisher_parse -a mode cmd
|
||||
set -e argv[1..2]
|
||||
command awk -v FS="[[:space:]]*#+" -v MODE="$mode" -v CMD="$cmd" -v ARGSTR="$argv" '
|
||||
BEGIN {
|
||||
for (n = split(ARGSTR, a, " "); i++ < n;) pkgs[getkey(a[i])] = a[i]
|
||||
}
|
||||
!NF { next } { k = getkey($1) }
|
||||
MODE == "-R" && !(k in pkgs) && $0 = $1
|
||||
MODE == "-W" && (/^#/ || k in pkgs || CMD != "rm") { print pkgs[k] (sub($1, "") ? $0 : "") }
|
||||
MODE == "-W" || CMD == "rm" { delete pkgs[k] }
|
||||
END {
|
||||
for (k in pkgs) {
|
||||
if (CMD != "rm" || MODE == "-W") print pkgs[k]
|
||||
else print "fisher: cannot remove \""k"\" -- package is not in fishfile" > "/dev/stderr"
|
||||
}
|
||||
}
|
||||
function getkey(s, a) {
|
||||
return (split(s, a, /@+|:/) > 2) ? a[2]"/"a[1]"/"a[3] : a[1]
|
||||
}
|
||||
'
|
||||
end
|
||||
|
||||
function _fisher_fetch
|
||||
set -l pkg_jobs
|
||||
set -l out_pkgs
|
||||
set -l next_pkgs
|
||||
set -l local_pkgs
|
||||
set -q fisher_user_api_token; and set -l curl_opts -u $fisher_user_api_token
|
||||
|
||||
for pkg in $argv
|
||||
switch $pkg
|
||||
case \~\* /\*
|
||||
set -l path (echo "$pkg" | command sed "s|^~|$HOME|")
|
||||
if test -e "$path"
|
||||
set local_pkgs $local_pkgs $path
|
||||
else
|
||||
echo "fisher: cannot add \"$pkg\" -- is this a valid file?" >&2
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
command awk -v PKG="$pkg" -v FS=/ '
|
||||
BEGIN {
|
||||
if (split(PKG, tmp, /@+|:/) > 2) {
|
||||
if (tmp[4]) sub("@"tmp[4], "", PKG)
|
||||
print PKG "\t" tmp[2]"/"tmp[1]"/"tmp[3] "\t" (tmp[4] ? tmp[4] : "master")
|
||||
} else {
|
||||
pkg = split(PKG, _, "/") <= 2 ? "github.com/"tmp[1] : tmp[1]
|
||||
tag = tmp[2] ? tmp[2] : "master"
|
||||
print (\
|
||||
pkg ~ /^github/ ? "https://codeload."pkg"/tar.gz/"tag : \
|
||||
pkg ~ /^gitlab/ ? "https://"pkg"/-/archive/"tag"/"tmp[split(pkg, tmp, "/")]"-"tag".tar.gz" : \
|
||||
pkg ~ /^bitbucket/ ? "https://"pkg"/get/"tag".tar.gz" : pkg \
|
||||
) "\t" pkg
|
||||
}
|
||||
}
|
||||
' | read -l url pkg branch
|
||||
|
||||
if test ! -d "$fisher_config/$pkg"
|
||||
fish -c "
|
||||
echo fetching $url >&2
|
||||
command mkdir -p $fisher_config/$pkg $fisher_cache/(command dirname $pkg)
|
||||
if test ! -z \"$branch\"
|
||||
command git clone $url $fisher_config/$pkg --branch $branch --depth 1 2>/dev/null
|
||||
or echo fisher: cannot clone \"$url\" -- is this a valid url\? >&2
|
||||
else if command curl $curl_opts -Ss -w \"\" $url 2>&1 | command tar -xzf- -C $fisher_config/$pkg 2>/dev/null
|
||||
command rm -Rf $fisher_cache/$pkg
|
||||
command mv -f $fisher_config/$pkg/* $fisher_cache/$pkg
|
||||
command rm -Rf $fisher_config/$pkg
|
||||
command cp -Rf {$fisher_cache,$fisher_config}/$pkg
|
||||
else if test -d \"$fisher_cache/$pkg\"
|
||||
echo fisher: cannot connect to server -- looking in \"$fisher_cache/$pkg\" | command sed 's|$HOME|~|' >&2
|
||||
command cp -Rf $fisher_cache/$pkg $fisher_config/$pkg/..
|
||||
else
|
||||
command rm -Rf $fisher_config/$pkg
|
||||
echo fisher: cannot add \"$pkg\" -- is this a valid package\? >&2
|
||||
end
|
||||
" >/dev/null &
|
||||
set pkg_jobs $pkg_jobs (_fisher_jobs --last)
|
||||
set next_pkgs $next_pkgs "$fisher_config/$pkg"
|
||||
end
|
||||
end
|
||||
|
||||
if set -q pkg_jobs[1]
|
||||
while for job in $pkg_jobs
|
||||
contains -- $job (_fisher_jobs); and break
|
||||
end
|
||||
end
|
||||
for pkg in $next_pkgs
|
||||
if test -d "$pkg"
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l local_prefix $fisher_config/local/$USER
|
||||
if test ! -d "$local_prefix"
|
||||
command mkdir -p $local_prefix
|
||||
end
|
||||
for pkg in $local_pkgs
|
||||
set -l target $local_prefix/(command basename $pkg)
|
||||
if test ! -L "$target"
|
||||
command ln -sf $pkg $target
|
||||
set out_pkgs $out_pkgs $pkg
|
||||
_fisher_add $pkg --link
|
||||
end
|
||||
end
|
||||
|
||||
if set -q out_pkgs[1]
|
||||
_fisher_fetch (
|
||||
for pkg in $out_pkgs
|
||||
if test -s "$pkg/fishfile"
|
||||
_fisher_fmt <$pkg/fishfile | _fisher_parse -R
|
||||
end
|
||||
end)
|
||||
printf "%s\n" $out_pkgs | _fisher_fmt
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_add -a pkg opts
|
||||
for src in $pkg/{functions,completions,conf.d}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
set target $fisher_path/conf.d/$target
|
||||
case $pkg/completions\*
|
||||
set target $fisher_path/completions/$target
|
||||
case $pkg/{functions,}\*
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target $fisher_path/conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target $fisher_path/functions/$target
|
||||
end
|
||||
end
|
||||
echo "linking $target" | command sed "s|$HOME|~|" >&2
|
||||
if set -q opts[1]
|
||||
command ln -sf $src $target
|
||||
else
|
||||
command cp -f $src $target
|
||||
end
|
||||
switch $target
|
||||
case \*.fish
|
||||
source $target >/dev/null 2>/dev/null
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_rm -a pkg
|
||||
for src in $pkg/{conf.d,completions,functions}/**.* $pkg/*.fish
|
||||
set -l target (command basename $src)
|
||||
set -l filename (command basename $target .fish)
|
||||
switch $src
|
||||
case $pkg/conf.d\*
|
||||
test "$filename.fish" = "$target"; and emit "$filename"_uninstall
|
||||
set target conf.d/$target
|
||||
case $pkg/completions\*
|
||||
test "$filename.fish" = "$target"; and complete -ec $filename
|
||||
set target completions/$target
|
||||
case $pkg/{,functions}\*
|
||||
test "$filename.fish" = "$target"; and functions -e $filename
|
||||
switch $target
|
||||
case uninstall.fish
|
||||
source $src
|
||||
continue
|
||||
case {init,key_bindings}.fish
|
||||
set target conf.d/(command basename $pkg)\_$target
|
||||
case \*
|
||||
set target functions/$target
|
||||
end
|
||||
end
|
||||
command rm -f $fisher_path/$target
|
||||
end
|
||||
if not functions -q fish_prompt
|
||||
source "$__fish_datadir$__fish_data_dir/functions/fish_prompt.fish"
|
||||
end
|
||||
end
|
||||
|
||||
function _fisher_jobs
|
||||
jobs $argv | command awk '/^[0-9]+\t/ { print $1 }'
|
||||
end
|
||||
|
||||
function _fisher_now -a elapsed
|
||||
switch (command uname)
|
||||
case Darwin \*BSD
|
||||
command perl -MTime::HiRes -e 'printf("%.0f\n", (Time::HiRes::time() * 1000) - $ARGV[0])' $elapsed
|
||||
case \*
|
||||
math (command date "+%s%3N") - "0$elapsed"
|
||||
end
|
||||
end
|
BIN
.config/fish/preview.png
Normal file
BIN
.config/fish/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
233
.config/fisher/github.com/matchai/spacefish/.all-contributorsrc
Normal file
233
.config/fisher/github.com/matchai/spacefish/.all-contributorsrc
Normal file
@ -0,0 +1,233 @@
|
||||
{
|
||||
"projectName": "spacefish",
|
||||
"projectOwner": "matchai",
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"files": [
|
||||
"README.md"
|
||||
],
|
||||
"imageSize": 100,
|
||||
"commit": true,
|
||||
"contributors": [
|
||||
{
|
||||
"login": "matchai",
|
||||
"name": "Matan Kushner",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/4658208?v=4",
|
||||
"profile": "https://twitter.com/matchai",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc",
|
||||
"review",
|
||||
"test",
|
||||
"tool",
|
||||
"design"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "sirMerr",
|
||||
"name": "Tiffany Le-Nguyen",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/11183523?v=4",
|
||||
"profile": "https://github.com/sirMerr",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc",
|
||||
"review",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Snuggle",
|
||||
"name": "Snuggle",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/26250962?v=4",
|
||||
"profile": "https://github.com/Snuggle",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc",
|
||||
"review",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jskrnbindra",
|
||||
"name": "Jaskaran Bindra",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/11844760?v=4",
|
||||
"profile": "https://github.com/jskrnbindra",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "kulabun",
|
||||
"name": "Konstantin Labun",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/6306918?v=4",
|
||||
"profile": "https://labun.me",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "kyleholzinger",
|
||||
"name": "Kyle Holzinger",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/2652762?v=4",
|
||||
"profile": "https://medium.com/@kyleholzinger",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "salmanulfarzy",
|
||||
"name": "Salmanul Farzy",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/10276208?v=4",
|
||||
"profile": "https://github.com/salmanulfarzy",
|
||||
"contributions": [
|
||||
"code",
|
||||
"review"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "owais",
|
||||
"name": "owais",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/46186?v=4",
|
||||
"profile": "https://owais.lone.pw",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ladysamantha",
|
||||
"name": "Samantha Enders",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/35412203?v=4",
|
||||
"profile": "https://github.com/ladysamantha",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "evanrelf",
|
||||
"name": "Evan Relf",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/887196?v=4",
|
||||
"profile": "https://evanrelf.com",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "JasonEtco",
|
||||
"name": "Jason Etcovitch",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/10660468?v=4",
|
||||
"profile": "https://jasonet.co",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "hrvoj3e",
|
||||
"name": "hrvoj3e",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/4988133?v=4",
|
||||
"profile": "https://github.com/hrvoj3e",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "newmaniese",
|
||||
"name": "Michael Newman",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/64894?v=4",
|
||||
"profile": "http://newmaniese.com",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "k-lyda",
|
||||
"name": "Konrad",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/6491400?v=4",
|
||||
"profile": "https://github.com/k-lyda",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "dubnev",
|
||||
"name": "Will Neville",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/3227558?v=4",
|
||||
"profile": "https://github.com/dubnev",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "danieltrautmann",
|
||||
"name": "Daniel Trautmann",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/4022138?v=4",
|
||||
"profile": "https://github.com/danieltrautmann",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Menturan",
|
||||
"name": "Jonas Öhlander",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/16061385?v=4",
|
||||
"profile": "https://github.com/Menturan",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lynzt",
|
||||
"name": "lindsay",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/3099491?v=4",
|
||||
"profile": "https://twitter.com/lynzt",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bradcypert",
|
||||
"name": "Brad",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1455979?v=4",
|
||||
"profile": "http://www.bradcypert.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "nammn",
|
||||
"name": "Nam Nguyen",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/23652004?v=4",
|
||||
"profile": "https://github.com/nammn",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "halostatue",
|
||||
"name": "Austin Ziegler",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/11361?v=4",
|
||||
"profile": "http://www.halostatue.ca/",
|
||||
"contributions": [
|
||||
"review"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7
|
||||
}
|
12
.config/fisher/github.com/matchai/spacefish/.editorconfig
Normal file
12
.config/fisher/github.com/matchai/spacefish/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.fish]
|
||||
indent_style = tab
|
6
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE.md
vendored
Normal file
6
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<!---
|
||||
Thank you for filing an issue 😄 ! Before you hit "Submit", please do the following:
|
||||
|
||||
Check the other issue templates if you are trying to submit a bug report, feature request, or a question
|
||||
Search existing issues before submitting since someone might have already submitted something similar!
|
||||
-->
|
32
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
32
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
name: 🐛 Bug Report
|
||||
about: If something isn't working as expected 🤔.
|
||||
|
||||
---
|
||||
|
||||
## Bug Report
|
||||
|
||||
**Current Behavior**
|
||||
A clear and concise description of the behavior.
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Relevant `Fish` Configuration**
|
||||
<!-- Can be found in ~/.config/fish/config.fish -->
|
||||
```fish
|
||||
# Your configuration here
|
||||
```
|
||||
|
||||
**Environment**
|
||||
- Spacefish version: [the output of `echo $SPACEFISH_VERSION`]
|
||||
- Fish version: [the output of `fish --version`]
|
||||
- Fish plugin manager: [e.g. oh-my-fish, fisher, fin]
|
||||
- Terminal emulator: [e.g. iTerm, Hyper, Terminator]
|
||||
- Operating system: [e.g. OSX 10.13.4, Windows 10]
|
||||
|
||||
**Possible Solution**
|
||||
<!--- Only if you have suggestions on a fix for the bug -->
|
||||
|
||||
**Additional context/Screenshots**
|
||||
Add any other context about the problem here. If applicable, add screenshots to help explain.
|
20
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
20
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: 🚀 Feature Request
|
||||
about: I have a suggestion (and may want to implement it 🙂)!
|
||||
|
||||
---
|
||||
|
||||
## Feature Request
|
||||
<!--
|
||||
Please keep in mind that we are working to achieve feature parity with Spaceship.
|
||||
If this proposed feature doesn't already exist in Spaceship, please submit a PR there instead.
|
||||
-->
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I have an issue when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen. Add any considered drawbacks.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
13
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Support_question.md
vendored
Normal file
13
.config/fisher/github.com/matchai/spacefish/.github/ISSUE_TEMPLATE/Support_question.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
name: 🤗 Support Question
|
||||
about: If you have a question about configuring Spacefish 💬
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
If you're having trouble configuring Spacefish, Feel free to ask us for a hand! 😄
|
||||
Be sure to search existing issues since someone might have already asked something similar.
|
||||
|
||||
Also, please take a second to read our TROUBLESHOOTING docs for commonly encountered problems:
|
||||
https://github.com/matchai/spacefish/blob/master/docs/Troubleshooting.md
|
||||
-->
|
33
.config/fisher/github.com/matchai/spacefish/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
33
.config/fisher/github.com/matchai/spacefish/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||
Closes #
|
||||
|
||||
## Types of changes
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
|
||||
## Screenshots (if appropriate):
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, tests ran to see how -->
|
||||
<!--- your change affects other areas of the code, etc. -->
|
||||
- [ ] I have tested using **MacOS**
|
||||
- [ ] I have tested using **Linux**
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] I have checked that no other PR duplicates mine
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] My change requires a change to the documentation.
|
||||
- [ ] I have updated the documentation accordingly.
|
||||
- [ ] I have updated the tests accordingly.
|
4
.config/fisher/github.com/matchai/spacefish/.github/release-drafter.yml
vendored
Normal file
4
.config/fisher/github.com/matchai/spacefish/.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
template: |
|
||||
## What's Changed
|
||||
|
||||
$CHANGES
|
2
.config/fisher/github.com/matchai/spacefish/.gitignore
vendored
Normal file
2
.config/fisher/github.com/matchai/spacefish/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
_book/
|
41
.config/fisher/github.com/matchai/spacefish/.travis.yml
Normal file
41
.config/fisher/github.com/matchai/spacefish/.travis.yml
Normal file
@ -0,0 +1,41 @@
|
||||
language: node_js
|
||||
node_js: stable
|
||||
env:
|
||||
global:
|
||||
- HOMEBREW_NO_AUTO_UPDATE=1
|
||||
- BREW_FISH2="https://raw.githubusercontent.com/Homebrew/homebrew-core/2827b020c3366ea93566a344167ba62388c16c7d/Formula/fish.rb"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
name: "Fish 2.X Linux"
|
||||
os: linux
|
||||
sudo: required
|
||||
install:
|
||||
- sudo apt-add-repository -y ppa:fish-shell/release-2
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y fish
|
||||
|
||||
- stage: test
|
||||
name: "Fish 2.X macOS"
|
||||
os: osx
|
||||
install: brew install $BREW_FISH2
|
||||
|
||||
- stage: test
|
||||
name: "Fish 3.X Linux"
|
||||
os: linux
|
||||
sudo: required
|
||||
install:
|
||||
- sudo apt-add-repository -y ppa:fish-shell/release-3
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y fish
|
||||
|
||||
- stage: test
|
||||
name: "Fish 3.X macOS"
|
||||
os: osx
|
||||
install: brew install fish
|
||||
|
||||
- stage: release
|
||||
provider: script
|
||||
skip_cleanup: true
|
||||
script: npx semantic-release
|
108
.config/fisher/github.com/matchai/spacefish/CHANGELOG.md
Normal file
108
.config/fisher/github.com/matchai/spacefish/CHANGELOG.md
Normal file
@ -0,0 +1,108 @@
|
||||
## [2.6.1](https://github.com/matchai/spacefish/compare/v2.6.0...v2.6.1) (2019-07-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct incorrectly named config options ([#198](https://github.com/matchai/spacefish/issues/198)) ([85f9ef5](https://github.com/matchai/spacefish/commit/85f9ef5))
|
||||
|
||||
# [2.6.0](https://github.com/matchai/spacefish/compare/v2.5.0...v2.6.0) (2019-06-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add elixir section ([#190](https://github.com/matchai/spacefish/issues/190)) ([9cb48ea](https://github.com/matchai/spacefish/commit/9cb48ea))
|
||||
|
||||
# [2.5.0](https://github.com/matchai/spacefish/compare/v2.4.0...v2.5.0) (2019-05-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* bump version ([13865c6](https://github.com/matchai/spacefish/commit/13865c6))
|
||||
|
||||
# [2.4.0](https://github.com/matchai/spacefish/compare/v2.3.1...v2.4.0) (2019-03-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add cargo package manager and refactor existing package section ([#171](https://github.com/matchai/spacefish/issues/171)) ([0064d2d](https://github.com/matchai/spacefish/commit/0064d2d))
|
||||
|
||||
## [2.3.1](https://github.com/matchai/spacefish/compare/v2.3.0...v2.3.1) (2019-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct typo in venv configuration variables ([#167](https://github.com/matchai/spacefish/issues/167)) ([8a3585c](https://github.com/matchai/spacefish/commit/8a3585c))
|
||||
|
||||
# [2.3.0](https://github.com/matchai/spacefish/compare/v2.2.4...v2.3.0) (2019-02-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add Python venv section ([#164](https://github.com/matchai/spacefish/issues/164)) ([3d777fc](https://github.com/matchai/spacefish/commit/3d777fc)), closes [#146](https://github.com/matchai/spacefish/issues/146)
|
||||
|
||||
## [2.2.4](https://github.com/matchai/spacefish/compare/v2.2.3...v2.2.4) (2019-02-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't throw errors when there are multiple GOPATHs ([#158](https://github.com/matchai/spacefish/issues/158)) ([653f1c8](https://github.com/matchai/spacefish/commit/653f1c8))
|
||||
|
||||
## [2.2.3](https://github.com/matchai/spacefish/compare/v2.2.2...v2.2.3) (2019-02-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* git status section shows the correct symbol for unmerged ([#159](https://github.com/matchai/spacefish/issues/159)) ([7c2a1d5](https://github.com/matchai/spacefish/commit/7c2a1d5))
|
||||
|
||||
## [2.2.2](https://github.com/matchai/spacefish/compare/v2.2.1...v2.2.2) (2019-02-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* show git status based on SPACEFISH_GIT_STATUS_SHOW ([#155](https://github.com/matchai/spacefish/issues/155)) ([1d34eb9](https://github.com/matchai/spacefish/commit/1d34eb9))
|
||||
|
||||
## [2.2.1](https://github.com/matchai/spacefish/compare/v2.2.0...v2.2.1) (2019-02-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use SPACEFISH_TIME_FORMAT when formatting time section ([#156](https://github.com/matchai/spacefish/issues/156)) ([6ab4ecc](https://github.com/matchai/spacefish/commit/6ab4ecc))
|
||||
|
||||
# [2.2.0](https://github.com/matchai/spacefish/compare/v2.1.0...v2.2.0) (2019-02-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for F# project detection in the dotnet section ([c104b04](https://github.com/matchai/spacefish/commit/c104b04))
|
||||
|
||||
# [2.1.0](https://github.com/matchai/spacefish/compare/v2.0.1...v2.1.0) (2019-01-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct go development version format ([e678ac2](https://github.com/matchai/spacefish/commit/e678ac2)), closes [#137](https://github.com/matchai/spacefish/issues/137)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve pyenv version detection ([22b9e20](https://github.com/matchai/spacefish/commit/22b9e20)), closes [#140](https://github.com/matchai/spacefish/issues/140)
|
||||
* provide docker version if in a docker container ([62891b4](https://github.com/matchai/spacefish/commit/62891b4)), closes [#138](https://github.com/matchai/spacefish/issues/138)
|
||||
|
||||
## [2.0.1](https://github.com/matchai/spacefish/compare/v2.0.0...v2.0.1) (2019-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* have ACPI use only the first battery value ([#126](https://github.com/matchai/spacefish/issues/126)) ([8fa713b](https://github.com/matchai/spacefish/commit/8fa713b))
|
||||
|
||||
# [2.0.0](https://github.com/matchai/spacefish/compare/v1.12.4...v2.0.0) (2019-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove color from prefix/suffix ([#133](https://github.com/matchai/spacefish/issues/133)) ([319f0b0](https://github.com/matchai/spacefish/commit/319f0b0))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Because prefix and suffix colors are no longer set to #fff, the color of prefix and suffix will be set to the default foreground color of your shell.
|
63
.config/fisher/github.com/matchai/spacefish/CONTRIBUTING.md
Normal file
63
.config/fisher/github.com/matchai/spacefish/CONTRIBUTING.md
Normal file
@ -0,0 +1,63 @@
|
||||
# Contributing
|
||||
|
||||
First of all, thank you for contributing. Any contribution is highly appreciated and welcome.
|
||||
|
||||
## Philosophy
|
||||
|
||||
There's a simple philosophy behind Spacefish:
|
||||
|
||||
* **Absolute parity with spaceship-prompt.** The prompt should be identical to spaceship-prompt when it comes to visuals, functionality, and configuration.
|
||||
|
||||
## Setup
|
||||
|
||||
1. **Fork** this repo (click the _fork_ button)
|
||||
2. **Clone** your fork to your computer (via `git clone`)
|
||||
3. **Make your changes**. Check our [API](./docs/API.md) for more information (we suggest you to check out a new branch for changes).
|
||||
4. **Test** your code (via `npm test`)
|
||||
5. **Add and commit** your contributions
|
||||
6. **Push** your changes to your remote fork
|
||||
7. **Open a pull-request** on the spacefish repo
|
||||
|
||||
## Testing
|
||||
|
||||
Unit tests are stored in the `./tests` directory, with the `(filename).test.fish` naming scheme.
|
||||
To run the unit tests, simply run:
|
||||
|
||||
```sh
|
||||
./tests/run.fish
|
||||
```
|
||||
|
||||
The unit tests will create their own temporary fish environment, so your local fish and spacefish configuration will not affect the unit test run.
|
||||
|
||||
## Sections
|
||||
|
||||
Spacefish supports most of the popular programming languages, runtimes, version managers, etc. If it doesn't support something that you need, feel free to open a pull request over at Spaceship, and it will be a candidate to be added to Spacefish.
|
||||
|
||||
### Will it slow down the prompt?
|
||||
|
||||
Every additional section will slow down the prompt a little bit. If your section performs any expensive checks, find a way to make it faster.
|
||||
|
||||
* **Good:** check if a command exists, check the value of an environment variable
|
||||
* **Bad:** network requests, reading large files, etc
|
||||
|
||||
## Documentation
|
||||
|
||||
When updating documentation for your section, make sure the markdown document is being properly rendered by Github. Specifically, the following common pitfalls have already been discovered:
|
||||
|
||||
* Empty inline code blocks ` ` will only be rendered if you put at least one non-breaking whitespace " " inside, like so: `` ` ` `` → ` `
|
||||
* Leading and trailing whitespaces in inline code blocks will be stripped, to indicate that a whitespace is present, use the middot symbol `·`, like so: `` `🐟·` `` → `🐟·`
|
||||
|
||||
## Add yourself as a contributor
|
||||
|
||||
This project follows the [all contributors](https://github.com/kentcdodds/all-contributors) specification. To add yourself to the table of
|
||||
contributors on the README.md, please use the automated script as part of your PR:
|
||||
|
||||
```console
|
||||
npm install
|
||||
npm run contributors:add -- <YOUR_GITHUB_USERNAME>
|
||||
```
|
||||
|
||||
Follow the prompt. If you've already added yourself to the list and are making a new type of contribution, you can run
|
||||
it again and select the added contribution type.
|
||||
|
||||
**Thank you for reading the contribution guide! Happy hacking!**
|
21
.config/fisher/github.com/matchai/spacefish/LICENSE
Normal file
21
.config/fisher/github.com/matchai/spacefish/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Matan Kushner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
157
.config/fisher/github.com/matchai/spacefish/README.md
Normal file
157
.config/fisher/github.com/matchai/spacefish/README.md
Normal file
File diff suppressed because one or more lines are too long
1
.config/fisher/github.com/matchai/spacefish/SUMMARY.md
Symbolic link
1
.config/fisher/github.com/matchai/spacefish/SUMMARY.md
Symbolic link
@ -0,0 +1 @@
|
||||
./docs/README.md
|
26
.config/fisher/github.com/matchai/spacefish/book.json
Normal file
26
.config/fisher/github.com/matchai/spacefish/book.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"gitbook": "3.x.x",
|
||||
"title": "Spacefish",
|
||||
"plugins": ["edit-link", "github", "github-buttons", "anchorjs", "ga"],
|
||||
"pluginsConfig": {
|
||||
"ga": {
|
||||
"token": "UA-71160903-2"
|
||||
},
|
||||
"edit-link": {
|
||||
"base": "https://github.com/matchai/spacefish/tree/master",
|
||||
"label": "Edit This Page"
|
||||
},
|
||||
"github": {
|
||||
"url": "https://github.com/matchai/spacefish/"
|
||||
},
|
||||
"github-buttons": {
|
||||
"buttons": [{
|
||||
"user": "matchai",
|
||||
"repo": "spacefish",
|
||||
"type": "star",
|
||||
"size": "small",
|
||||
"count": true
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
162
.config/fisher/github.com/matchai/spacefish/docs/API.md
Normal file
162
.config/fisher/github.com/matchai/spacefish/docs/API.md
Normal file
@ -0,0 +1,162 @@
|
||||
# API
|
||||
|
||||
This page describes the Spacefish API for creating plugins and tweaking Spacefish's behavior.
|
||||
|
||||
Spacefish uses the `SPACEFISH_` prefix for variables and the `__sf_` prefix for functions to avoid namespace collisions. All sections, including custom ones, are required to use the `__sf_` prefix before their name to load correctly.
|
||||
|
||||
## Example section
|
||||
|
||||
Below is an example of a typical section for Spacefish. Pay attention to a few critical aspects:
|
||||
|
||||
* Variables used for configuration should start with `SPACEFISH_`.
|
||||
* The section's name should start with `__sf_`.
|
||||
* Only show the section as is needed (only in directories containing specific files, when a specific command is available, etc).
|
||||
|
||||
Take a look at [Contribution guidelines](../CONTRIBUTING.md) for further details.
|
||||
|
||||
```sh
|
||||
#
|
||||
# Foobar
|
||||
#
|
||||
# Foobar is a supa-dupa cool tool for making you development easier.
|
||||
# Link: https://www.foobar.xyz
|
||||
|
||||
# __sf_ prefix before section's name is required!
|
||||
# Otherwise this section won't be loaded.
|
||||
function __sf_section_foobar -d "Show foobar status"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_FOOBAR_SHOW true
|
||||
__sf_util_set_default SPACEFISH_FOOBAR_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_FOOBAR_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_FOOBAR_SYMBOL "🍷 "
|
||||
__sf_util_set_default SPACEFISH_FOOBAR_COLOR white
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# If SPACEFISH_FOOBAR_SHOW is false, don't show the foobar section
|
||||
[ $SPACEFISH_FOOBAR_SHOW = false ]; and return
|
||||
|
||||
# If the foobar command doesn't exist, don't show the foobar section
|
||||
type -q foobar; or return
|
||||
|
||||
# Here some of the various expressions that can be tested
|
||||
# The full list can be found here:
|
||||
# https://fishshell.com/docs/current/commands.html#test
|
||||
type -q command # test that a command exists
|
||||
test -e /path/to/file # test that a file exists
|
||||
test -d /path/to/dir # test that a directory exists
|
||||
test operand1 = operand2 # that for two equal strings
|
||||
test -n "$variable" # test that a variable exists
|
||||
|
||||
# Use `set -l` to define local variables to avoid populating
|
||||
# the global namespace
|
||||
set -l foobar_status
|
||||
|
||||
if test "$SOME_CONDITION" = "true"
|
||||
set foobar_status (foobar baz)
|
||||
else
|
||||
set foobar_status (foobar foo)
|
||||
end
|
||||
|
||||
# Display the foobar section
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_FOOBAR_COLOR \
|
||||
$SPACEFISH_FOOBAR_PREFIX \
|
||||
$SPACEFISH_FOOBAR_SYMBOL \
|
||||
$SPACEFISH_FOOBAR_SUFFIX
|
||||
end
|
||||
```
|
||||
|
||||
## `SPACEFISH_VERSION`
|
||||
|
||||
An environment variable that defines the version of currently running Spacefish prompt. Can be used for issue reporting or debugging purposes.
|
||||
|
||||
Accessible to any program or script running in a current shell session.
|
||||
|
||||
### Example
|
||||
|
||||
```sh
|
||||
echo $SPACEFISH_VERSION
|
||||
#> 0.1.0
|
||||
```
|
||||
|
||||
## `__sf_lib_section <color> [prefix] <content> [suffix]`
|
||||
|
||||
This function prints out the prompt section prefixed with `prefix`, suffixed with `suffix` and `content` formatted to display in `color`. The **Bold** style is applied by default.
|
||||
|
||||
`prefix`, `suffix` and `content` can contain `set_color` to set an additional foreground color, background color or other formatting styles. Read more about `set_color` in the [set_color - set the terminal color](https://fishshell.com/docs/current/commands.html#set_color) section of the Fish Shell documentation.
|
||||
|
||||
If `SPACEFISH_PROMPT_PREFIXES_SHOW` is `false` or if the section is the first to appear in the prompt, then `prefix` will be omitted.
|
||||
|
||||
If `SPACEFISH_PROMPT_SUFFIXES_SHOW` is `false`, then `suffix` will be omitted.
|
||||
|
||||
Both `prefix` and `suffix` are optional. They are equal to empty strings by default.
|
||||
|
||||
### Arguments
|
||||
|
||||
1. `color` _Required_ — The color used when displaying the `content`. Can be any of the valid [basic colors](https://fishshell.com/docs/current/commands.html#set_color) or can be any valid RGB hex code.
|
||||
2. `prefix` _Optional_ — The prefix shown before `content`. Usually, it's the value of `SPACEFISH_*_PREFIX`.
|
||||
3. `content` _Required_ — The content of the section. Can be any valid value or the result of command execution.
|
||||
4. `suffix` _Optional_ — The suffix shown after `content`. Usually, it's the value of `SPACEFISH_*_SUFFIX`.
|
||||
|
||||
### Example
|
||||
|
||||
```sh
|
||||
# Display the prompt section with a prefix and suffix
|
||||
# Backslash is used to escape the line endings
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_SECTION_COLOR \
|
||||
$SPACEFISH_SECTION_PREFIX \
|
||||
$SPACEFISH_SECTION_SYMBOL$section_content \
|
||||
$SPACEFISH_SECTION_SUFFIX
|
||||
|
||||
# Display prompt section without prefix and suffix
|
||||
__sf_lib_section $color $SPACEFISH_CHAR_SYMBOL
|
||||
```
|
||||
|
||||
## `__sf_util_set_default <variable_name> <value>`
|
||||
|
||||
This utility function is used to define a default value for a variable while allowing it to be overwritten by a user's personal configuration files (e.g. setting it in their `config.fish`)
|
||||
|
||||
### Arguments
|
||||
|
||||
1. `variable_name` _Required_ — the name of the configuration variable.
|
||||
2. `value` _Required_ — the value to be assigned by default.
|
||||
|
||||
### Example
|
||||
|
||||
```sh
|
||||
# Preassign a value to `SPACEFISH_CHAR_SYMBOL`
|
||||
set -g SPACEFISH_CHAR_SYMBOL ❯
|
||||
|
||||
# Assign a value if one doesn't already exist
|
||||
__sf_util_set_default SPACEFISH_CHAR_SYMBOL ■
|
||||
__sf_util_set_default SPACEFISH_RUBY_SYMBOL 💎
|
||||
|
||||
# The original value assigned is used
|
||||
echo $SPACEFISH_CHAR_SYMBOL
|
||||
#> ❯
|
||||
|
||||
echo $SPACEFISH_RUBY_SYMBOL
|
||||
#> 💎
|
||||
```
|
||||
|
||||
## `__sf_util_git_branch`
|
||||
|
||||
This utility returns the current branch name if the current working directory is a Git repository, and will return nothing if it's not.
|
||||
|
||||
### Example
|
||||
|
||||
```sh
|
||||
# Return if the current working directory is not a Git repository
|
||||
[ -z (__sf_util_git_branch) ]; and return
|
||||
|
||||
# Print the Git branch name of the current working directory
|
||||
echo (__sf_util_git_branch)
|
||||
#> master
|
||||
```
|
438
.config/fisher/github.com/matchai/spacefish/docs/Options.md
Normal file
438
.config/fisher/github.com/matchai/spacefish/docs/Options.md
Normal file
@ -0,0 +1,438 @@
|
||||
## Options
|
||||
|
||||
You have ability to customize or disable specific elements of Spacefish. All options must be overridden in your `config.fish`.
|
||||
|
||||
Colors for sections can be [basic colors](https://fishshell.com/docs/current/commands.html#set_color) or [color codes](https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg).
|
||||
|
||||
**Note:** the symbol `·` in this document represents a regular space character ` `, it is used to clearly indicate when an option default value starts or ends with a space.
|
||||
|
||||
### Order
|
||||
|
||||
You can specify the order of prompt section using `SPACEFISH_PROMPT_ORDER` option. Use Zsh array syntax to define your own prompt order.
|
||||
|
||||
The order also defines which sections that Spacefish loads. If you're struggling with slow prompt, you can just omit the sections that you don't use, and they won't be loaded.
|
||||
|
||||
The default order is:
|
||||
|
||||
```fish
|
||||
set SPACEFISH_PROMPT_ORDER time user dir host git package node docker ruby golang php rust haskell julia aws conda pyenv kubecontext exec_time line_sep battery jobs exit_code char
|
||||
```
|
||||
You can also add items to the right prompt by specifying them in the `SPACEFISH_RPROMPT_ORDER` option. By default `SPACEFISH_RPROMPT_ORDER` is empty.
|
||||
|
||||
### Prompt
|
||||
|
||||
This group of options defines a behavior of prompt and standard parameters for sections displaying.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_PROMPT_ADD_NEWLINE` | `true` | Adds a newline character before each prompt line |
|
||||
| `SPACEFISH_PROMPT_SEPARATE_LINE` | `true` | Make the prompt span across two lines |
|
||||
| `SPACEFISH_PROMPT_FIRST_PREFIX_SHOW` | `false` | Shows a prefix of the first section in prompt |
|
||||
| `SPACEFISH_PROMPT_PREFIXES_SHOW` | `true` | Show prefixes before prompt sections |
|
||||
| `SPACEFISH_PROMPT_SUFFIXES_SHOW` | `true` | Show suffixes before prompt sections |
|
||||
| `SPACEFISH_PROMPT_DEFAULT_PREFIX` | `via` | Default prefix for prompt sections |
|
||||
| `SPACEFISH_PROMPT_DEFAULT_SUFFIX` | ` ` | Default suffix for prompt section |
|
||||
|
||||
### Time \(`time`\)
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_TIME_SHOW` | `false` | Show current time |
|
||||
| `SPACEFISH_DATE_SHOW` | `false·` | Show today's date |
|
||||
| `SPACEFISH_TIME_PREFIX` | `at·` | Prefix before time section |
|
||||
| `SPACEFISH_TIME_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after time section |
|
||||
| `SPACEFISH_TIME_FORMAT` | `false` | Custom time/date formatting, set as a string to enable (`man date` for help) |
|
||||
| `SPACEFISH_TIME_12HR` | `false` | Use 12 hour clock AM/PM |
|
||||
| `SPACEFISH_TIME_COLOR` | `yellow` | Color of time section |
|
||||
|
||||
### Username \(`user`\)
|
||||
|
||||
By default, a username is shown only when it's not the same as `$LOGNAME`, when you're connected via SSH or when you're root. Root user is highlighted in `SPACEFISH_USER_COLOR_ROOT` color (red as default).
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_USER_SHOW` | `true` | Show user section (`true`, `false`, `always` or `needed`) |
|
||||
| `SPACEFISH_USER_PREFIX` | `with·` | Prefix before user section |
|
||||
| `SPACEFISH_USER_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after user section |
|
||||
| `SPACEFISH_USER_COLOR` | `yellow` | Color of user section |
|
||||
| `SPACEFISH_USER_COLOR_ROOT` | `red` | Color of user section when it's root |
|
||||
|
||||
`SPACEFISH_USER_SHOW` defines when to show username section. Here are possible values:
|
||||
|
||||
| `SPACEFISH_USER_SHOW` | Show on local | Show on remote |
|
||||
| :-------------------: | :------------- | :-------------- |
|
||||
| `false` | Never | Never |
|
||||
| `always` | Always | Always |
|
||||
| `true` | If needed | Always |
|
||||
| `needed` | If needed | If needed |
|
||||
|
||||
|
||||
### Directory \(`dir`\)
|
||||
|
||||
Directory is always shown and truncated to the value of `SPACEFISH_DIR_TRUNC`. While you are in a Git repository, this section shows only the project title and relevant status icons. If current directory is write-protected or if current user doesn't have write permissions, a padlock (by default) will be displayed as a suffix.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_DIR_SHOW` | `true` | Show directory section |
|
||||
| `SPACEFISH_DIR_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after current directory |
|
||||
| `SPACEFISH_DIR_TRUNC` | `3` | Number of folders of cwd to show in prompt, 0 to show all |
|
||||
| `SPACEFISH_DIR_TRUNC_REPO` | `true` | While in `git` repo, show only root directory and folders inside it |
|
||||
| `SPACEFISH_DIR_COLOR` | `cyan` | Color of directory section |
|
||||
| `SPACEFISH_DIR_PREFIX` | `in·` | Prefix before current directory |
|
||||
| `SPACEFISH_DIR_LOCK_SHOW` | `true` | Show directory write-protected symbol |
|
||||
| `SPACEFISH_DIR_LOCK_SYMBOL` |  | The symbol displayed if directory is write-protected (requires powerline patched font) |
|
||||
| `SPACEFISH_DIR_LOCK_COLOR` | `red` | Color for the lock symbol |
|
||||
|
||||
### Hostname \(`host`\)
|
||||
|
||||
Hostname should only be shown while you are connected to another machine using SSH, unless you change it using SPACEFISH_HOST_SHOW.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_HOST_SHOW` | `true` | Show host section (`true`, `false`, `always`) |
|
||||
| `SPACEFISH_HOST_SHOW_FULL` | `false` | Show full hostname section (`true`, `false`) |
|
||||
| `SPACEFISH_HOST_PREFIX` | `at·` | Prefix before the hostname |
|
||||
| `SPACEFISH_HOST_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the hostname |
|
||||
| `SPACEFISH_HOST_COLOR` | `blue` | Color of the hostname |
|
||||
| `SPACEFISH_HOST_COLOR_SSH` | `green` | Color of the hostname during SSH |
|
||||
|
||||
### Git \(`git`\)
|
||||
|
||||
Git section is consists with `git_branch` and `git_status` subsections. It is shown only in Git repositories.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_GIT_SHOW` | `true` | Show Git section |
|
||||
| `SPACEFISH_GIT_PREFIX` | `on·` | Prefix before Git section |
|
||||
| `SPACEFISH_GIT_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Git section |
|
||||
| `SPACEFISH_GIT_SYMBOL` |  | Character to be shown before Git section \(requires [powerline patched font](https://github.com/powerline/fonts) |
|
||||
|
||||
#### Git branch \(`git_branch`\)
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_GIT_BRANCH_SHOW` | `true` | Show Git branch subsection |
|
||||
| `SPACEFISH_GIT_BRANCH_PREFIX` | `$SPACEFISH_GIT_SYMBOL` | Prefix before Git branch subsection |
|
||||
| `SPACEFISH_GIT_BRANCH_SUFFIX` | ` ` | Suffix after Git branch subsection |
|
||||
| `SPACEFISH_GIT_BRANCH_COLOR` | `(set_color magenta)` | Color of Git branch subsection |
|
||||
|
||||
#### Git status \(`git_status`\)
|
||||
|
||||
Git status indicators is shown only when you have dirty repository.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_GIT_STATUS_SHOW` | `true` | Show Git status subsection |
|
||||
| `SPACEFISH_GIT_STATUS_PREFIX` | `·[` | Prefix before Git status subsection |
|
||||
| `SPACEFISH_GIT_STATUS_SUFFIX` | `]` | Suffix after Git status subsection |
|
||||
| `SPACEFISH_GIT_STATUS_COLOR` | `red` | Color of Git status subsection |
|
||||
| `SPACEFISH_GIT_STATUS_UNTRACKED` | `?` | Indicator for untracked changes |
|
||||
| `SPACEFISH_GIT_STATUS_ADDED` | `+` | Indicator for added changes |
|
||||
| `SPACEFISH_GIT_STATUS_MODIFIED` | `!` | Indicator for unstaged files |
|
||||
| `SPACEFISH_GIT_STATUS_RENAMED` | `»` | Indicator for renamed files |
|
||||
| `SPACEFISH_GIT_STATUS_DELETED` | `✘` | Indicator for deleted files |
|
||||
| `SPACEFISH_GIT_STATUS_STASHED` | `$` | Indicator for stashed changes |
|
||||
| `SPACEFISH_GIT_STATUS_UNMERGED` | `=` | Indicator for unmerged changes |
|
||||
| `SPACEFISH_GIT_STATUS_AHEAD` | `⇡` | Indicator for unpushed changes \(ahead of remote branch\) |
|
||||
| `SPACEFISH_GIT_STATUS_BEHIND` | `⇣` | Indicator for unpulled changes \(behind of remote branch\) |
|
||||
| `SPACEFISH_GIT_STATUS_DIVERGED` | `⇕` | Indicator for diverged chages \(diverged with remote branch\) |
|
||||
|
||||
### Package version \(`package`\)
|
||||
|
||||
> Works only for [npm](https://www.npmjs.com/) and [cargo](https://crates.io/) at the moment. Please, help [spaceship](https://github.com/denysdovhan/spaceship-prompt) improve this section!
|
||||
|
||||
Package version is shown when repository is a package (e.g. contains a `package.json` or `Cargo.toml` file). If no version information is found in `package.json` or there is an error parsing `Cargo.toml`, the `⚠` symbol will be shown.
|
||||
|
||||
* **npm** — `npm` package contains a `package.json` file. We use `jq`, `python` to parse package version for improving performance and `node` as a fallback. Install [jq](https://stedolan.github.io/jq/) for **improved performance** of this section ([Why?](./Troubleshooting.md#why-is-my-prompt-slow))
|
||||
* **cargo** — `cargo` package contains a `Cargo.toml` file. Currently, we use `cargo pkgid`, it depends on `Cargo.lock`. So if package version isn't shown, you may need to run some command like `cargo build` which can generate `Cargo.lock` file.
|
||||
|
||||
> **Note:** This is the version of the package you are working on, not the version of package manager itself.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_PACKAGE_SHOW` | `true` | Show package version |
|
||||
| `SPACEFISH_PACKAGE_PREFIX` | `is·` | Prefix before package version section |
|
||||
| `SPACEFISH_PACKAGE_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after package version section |
|
||||
| `SPACEFISH_PACKAGE_SYMBOL` | `📦·` | Character to be shown before package version |
|
||||
| `SPACEFISH_PACKAGE_COLOR` | `red` | Color of package version section |
|
||||
|
||||
### Node.js \(`node`\)
|
||||
|
||||
Node.js section is shown only in directories that contain `package.json` file, or `node_modules` folder, or any other file with `.js` extension.
|
||||
|
||||
If you set `SPACEFISH_NODE_DEFAULT_VERSION` to the default Node.js version and your current version is the same as `SPACEFISH_NODE_DEFAULT_VERSION`, then Node.js section will be hidden.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_NODE_SHOW` | `true` | Current Node.js section |
|
||||
| `SPACEFISH_NODE_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before Node.js section |
|
||||
| `SPACEFISH_NODE_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Node.js section |
|
||||
| `SPACEFISH_NODE_SYMBOL` | `⬢·` | Character to be shown before Node.js version |
|
||||
| `SPACEFISH_NODE_DEFAULT_VERSION` | ` ` | Node.js version to be treated as default |
|
||||
| `SPACEFISH_NODE_COLOR` | `green` | Color of Node.js section |
|
||||
|
||||
### Julia \(`julia`\)
|
||||
|
||||
Julia section is shown only in directories that contain any file with `.jl` extension.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_JULIA_SHOW` | `true` | Show Julia section |
|
||||
| `SPACEFISH_JULIA_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before Julia section |
|
||||
| `SPACEFISH_JULIA_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Julia section |
|
||||
| `SPACEFISH_JULIA_SYMBOL` | `ஃ·` | Character to be shown before Julia version |
|
||||
| `SPACEFISH_JULIA_COLOR` | `green` | Color of Julia section |
|
||||
|
||||
### Docker (`docker`)
|
||||
|
||||
Docker section is shown only in directories that contain `Dockerfile` or `docker-compose.yml` and also if the `$COMPOSE_FILE` is set.
|
||||
The section will also appear when `.dockerenv` is in the root directory, signifying that you're in a container.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_DOCKER_SHOW` | `true` | Show current Docker version |
|
||||
| `SPACEFISH_DOCKER_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the Docker section |
|
||||
| `SPACEFISH_DOCKER_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the Docker section |
|
||||
| `SPACEFISH_DOCKER_SYMBOL` | `🐳·` | Character to be shown before Docker version |
|
||||
| `SPACEFISH_DOCKER_COLOR` | `cyan` | Color of Docker section |
|
||||
| `SPACEFISH_DOCKER_VERBOSE_VERSION` | `false` | Show full version name. (Beta, Nightly) |
|
||||
|
||||
### Ruby \(`ruby`\)
|
||||
|
||||
Ruby section is shown only in directories that contain `Gemfile`, or `Rakefile`, or any other file with `.rb` extension.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_RUBY_SHOW` | `true` | Show Ruby section |
|
||||
| `SPACEFISH_RUBY_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before Ruby section |
|
||||
| `SPACEFISH_RUBY_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Ruby section |
|
||||
| `SPACEFISH_RUBY_SYMBOL` | `💎·` | Character to be shown before Ruby version |
|
||||
| `SPACEFISH_RUBY_COLOR` | `red` | Color of Ruby section |
|
||||
|
||||
### Haskell \(`haskell`\)
|
||||
|
||||
Haskell section is shown only in directories that contain `stack.yaml`.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_HASKELL_SHOW` | `true` | Show Haskell section |
|
||||
| `SPACEFISH_HASKELL_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before Haskell section |
|
||||
| `SPACEFISH_HASKELL_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Haskell section |
|
||||
| `SPACEFISH_HASKELL_SYMBOL` | `λ·` | Character to be shown before Haskell version |
|
||||
| `SPACEFISH_HASKELL_COLOR` | `red` | Color of Haskell section |
|
||||
|
||||
### Amazon Web Services (AWS) (`aws`)
|
||||
|
||||
Shows selected Amazon Web Services profile configured using [`AWS_PROFILE`](http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html) variable.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_AWS_SHOW` | `true` | Show current selected AWS-cli profile or not |
|
||||
| `SPACEFISH_AWS_PREFIX` | `using·` | Prefix before the AWS section |
|
||||
| `SPACEFISH_AWS_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the AWS section |
|
||||
| `SPACEFISH_AWS_SYMBOL` | `☁️·` | Character to be shown before AWS profile |
|
||||
| `SPACEFISH_AWS_COLOR` | `ff8700` | Color of AWS section |
|
||||
|
||||
### Virtualenv (`venv`)
|
||||
|
||||
Python virtual environment when $VIRTUAL_ENV is set.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_VENV_SHOW` | `true` | Show current Python virtualenv or not |
|
||||
| `SPACEFISH_VENV_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the virtualenv section |
|
||||
| `SPACEFISH_VENV_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the virtualenv section |
|
||||
| `SPACEFISH_VENV_SYMBOL` | `·` | Character to be shown before virtualenv |
|
||||
| `SPACEFISH_VENV_GENERIC_NAMES` | `virtualenv venv .venv` | If the virtualenv folder is in this *array*, than use its parent directory as its name instead |
|
||||
| `SPACEFISH_VENV_COLOR` | `blue` | Color of virtualenv environment section |
|
||||
|
||||
|
||||
### Conda \(`conda`\)
|
||||
|
||||
Conda section is shown when ```conda``` is installed and $CONDA_DEFAULT_ENV is set.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_CONDA_SHOW` | `true` | Show current Conda version |
|
||||
| `SPACEFISH_CONDA_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the conda section |
|
||||
| `SPACEFISH_CONDA_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the conda section |
|
||||
| `SPACEFISH_CONDA_SYMBOL` | `🅒·` | Character to be shown before Conda version |
|
||||
| `SPACEFISH_CONDA_COLOR` | `blue` | Color of Conda section |
|
||||
|
||||
|
||||
### Elixir \(`elixir`\)
|
||||
|
||||
Elixir section is shown when ```mix.exs``` is found or elixir files are found and either kiex, exenv, elixir is avaiable on your path.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_ELIXIR_SHOW` | `true` | Show current Elixir version |
|
||||
| `SPACEFISH_ELIXIR_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the elixir section |
|
||||
| `SPACEFISH_ELIXIR_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the elixir section |
|
||||
| `SPACEFISH_ELIXIR_SYMBOL` | `💧·` | Character to be shown before Elixir version |
|
||||
| `SPACEFISH_ELIXIR_COLOR` | `magenta` | Color of Elixir section |
|
||||
|
||||
### Pyenv \(`pyenv`\)
|
||||
|
||||
Pyenv section is shown only in directories that contain `.python-version`, `requirements.txt`, `pyproject.toml`, or any other file with `.py` extension.
|
||||
The section will also be shown if the `$PYENV_VERSION` environment variable is set.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_PYENV_SHOW` | `true` | Show current Pyenv version |
|
||||
| `SPACEFISH_PYENV_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the pyenv section |
|
||||
| `SPACEFISH_PYENV_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the pyenv section |
|
||||
| `SPACEFISH_PYENV_SYMBOL` | `🐍·` | Character to be shown before Pyenv version |
|
||||
| `SPACEFISH_PYENV_COLOR` | `yellow` | Color of Pyenv section |
|
||||
|
||||
### Go \(`golang`\)
|
||||
|
||||
Go section is shown only in directories that contain `Godeps`, `glide.yaml`, `go.mod`, any other file with `.go` extension, or when current directory is in the Go workspace defined in `$GOPATH`.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_GOLANG_SHOW` | `true` | Show current Go version |
|
||||
| `SPACEFISH_GOLANG_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the Go section |
|
||||
| `SPACEFISH_GOLANG_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the Go section |
|
||||
| `SPACEFISH_GOLANG_SYMBOL` | `🐹·` | Character to be shown before Go version |
|
||||
| `SPACEFISH_GOLANG_COLOR` | `cyan` | Color of Go section |
|
||||
|
||||
### PHP (`php`)
|
||||
|
||||
PHP section is shown only in directories that contain `composer.json` file, or any other file with `.php` extension.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_PHP_SHOW` | true | Show PHP section |
|
||||
| `SPACEFISH_PHP_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the PHP section |
|
||||
| `SPACEFISH_PHP_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the PHP section |
|
||||
| `SPACEFISH_PHP_SYMBOL` | `🐘·` | Character to be shown before PHP version |
|
||||
| `SPACEFISH_PHP_COLOR` | `blue` | Color of PHP section |
|
||||
|
||||
### Rust (`rust`)
|
||||
|
||||
Rust section is shown only in directories that contain `Cargo.toml` or any other file with `.rs` extension.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_RUST_SHOW` | `true` | Show current Rust version |
|
||||
| `SPACEFISH_RUST_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the Rust section |
|
||||
| `SPACEFISH_RUST_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the Rust section |
|
||||
| `SPACEFISH_RUST_SYMBOL` | `𝗥·` | Character to be shown before Rust version |
|
||||
| `SPACEFISH_RUST_COLOR` | `red` | Color of Rust section |
|
||||
| `SPACEFISH_RUST_VERBOSE_VERSION` | `false` | Show what branch is being used, if any. (Beta, Nightly) |
|
||||
|
||||
### .NET (`dotnet`)
|
||||
|
||||
.NET section is shown only in directories that contains a `project.json`, `global.json` or `paket.dependencies` file, or a file with one of these extensions: `.csproj`, `.xproj`, `.fproj` or `.sln`.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_DOTNET_SHOW` | `true` | Current .NET section |
|
||||
| `SPACEFISH_DOTNET_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before .NET section |
|
||||
| `SPACEFISH_DOTNET_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after .NET section |
|
||||
| `SPACEFISH_DOTNET_SYMBOL` | `.NET·` | Character to be shown before .NET version |
|
||||
| `SPACEFISH_DOTNET_COLOR` | `128` | Color of .NET section |
|
||||
|
||||
### Kubectl context \(`kubecontext`\)
|
||||
|
||||
Kubernetes context is shown everywhere if `kubectl` binary is found.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_KUBECONTEXT_SHOW` | `true` | Show current kubectl context |
|
||||
| `SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW` | `true` | Show current kubectl context namespace|
|
||||
| `SPACEFISH_KUBECONTEXT_PREFIX` | `at ` | Prefix before the kubectl section |
|
||||
| `SPACEFISH_KUBECONTEXT_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the kubectl section |
|
||||
| `SPACEFISH_KUBECONTEXT_SYMBOL` | `☸️ ` | Character to be shown before kubectl context |
|
||||
| `SPACEFISH_KUBECONTEXT_COLOR` | `cyan` | Color of kubectl section |
|
||||
|
||||
### Exec Time \(`exec_time`\)
|
||||
|
||||
Execution time of the last command. Will be displayed if it exceeds the set threshold of time.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_EXEC_TIME_SHOW` | `true` | Show execution time |
|
||||
| `SPACEFISH_EXEC_TIME_PREFIX` | `took·` | Prefix before exec time section |
|
||||
| `SPACEFISH_EXEC_TIME_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after exec time section |
|
||||
| `SPACEFISH_EXEC_TIME_COLOR` | `yellow` | Color of exec time section |
|
||||
| `SPACEFISH_EXEC_TIME_ELAPSED` | `5` | The threshold in seconds for showing exec time section |
|
||||
|
||||
### Line Separator \(`line_sep`\)
|
||||
|
||||
This is where the prompt will split into two lines, if enabled.
|
||||
|
||||
### Battery \(`battery`\)
|
||||
|
||||
By default, Battery section is shown only if battery level is below `SPACEFISH_BATTERY_THRESHOLD` \(default: 10%\).
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_BATTERY_SHOW` | `true` | Show battery section \(`true`, `false`, `always` or `charged`\) |
|
||||
| `SPACEFISH_BATTERY_PREFIX` | ` ` | Prefix before battery section |
|
||||
| `SPACEFISH_BATTERY_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after battery section |
|
||||
| `SPACEFISH_BATTERY_SYMBOL_CHARGING` | `⇡` | Character to be shown if battery is charging |
|
||||
| `SPACEFISH_BATTERY_SYMBOL_DISCHARGING` | `⇣` | Character to be shown if battery is discharging |
|
||||
| `SPACEFISH_BATTERY_SYMBOL_FULL` | `•` | Character to be shown if battery is full |
|
||||
| `SPACEFISH_BATTERY_THRESHOLD` | 10 | Battery level below which battery section will be shown |
|
||||
|
||||
`SPACEFISH_BATTERY_SHOW` defines when to show battery section. Here are possible values:
|
||||
|
||||
| `SPACEFISH_BATTERY_SHOW` | Below threshold | Above threshold | Fully charged |
|
||||
| :---: | :--- | :--- | :--- |
|
||||
| `false` | Hidden | Hidden | Hidden |
|
||||
| `always` | Shown | Shown | Shown |
|
||||
| `true` | Shown | Hidden | Hidden |
|
||||
| `charged` | Shown | Hidden | Shown |
|
||||
|
||||
### Vi-mode \( vi_mode \)
|
||||
|
||||
This section shows mode indicator only when Vi-mode is enabled.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_VI_MODE_SHOW` | `true` | Shown current Vi-mode or not |
|
||||
| `SPACEFISH_VI_MODE_PREFIX` | ` ` | Prefix before Vi-mode section |
|
||||
| `SPACEFISH_VI_MODE_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after Vi-mode section |
|
||||
| `SPACEFISH_VI_MODE_INSERT` | `[I]` | Text to be shown when in insert mode |
|
||||
| `SPACEFISH_VI_MODE_NORMAL` | `[N]` | Text to be shown when in normal mode |
|
||||
| `SPACEFISH_VI_MODE_VISUAL` | `[V]` | Text to be shown when in visual mode |
|
||||
| `SPACEFISH_VI_MODE_REPLACE_ONE` | `[R]` | Text to be shown when in replace_one mode |
|
||||
| `SPACEFISH_VI_MODE_COLOR` | `white` | Color of Vi-mode section |
|
||||
|
||||
### Jobs \(`jobs`\)
|
||||
|
||||
This section only shows when there are backgrounded jobs.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `SPACEFISH_JOBS_SHOW` | `true` | Show background jobs indicator |
|
||||
| `SPACEFISH_JOBS_PREFIX` | ` ` | Prefix before the jobs indicator |
|
||||
| `SPACEFISH_JOBS_SUFFIX` | ` ` | Suffix after the jobs indicator |
|
||||
| `SPACEFISH_JOBS_SYMBOL` | `✦` | Character to be shown when jobs are hiding |
|
||||
| `SPACEFISH_JOBS_COLOR` | `blue` | Color of background jobs section |
|
||||
| `SPACEFISH_JOBS_AMOUNT_PREFIX` | ` ` | Prefix before the number of jobs |
|
||||
| `SPACEFISH_JOBS_AMOUNT_SUFFIX` | ` ` | Suffix after the number of jobs |
|
||||
| `SPACEFISH_JOBS_AMOUNT_THRESHOLD` | `1` | Number of jobs after which job count will be shown |
|
||||
|
||||
### Exit Code \(`exit_code`\)
|
||||
Disabled by default. Set `SPACEFISH_EXIT_CODE_SHOW` to `true` to enable.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_EXIT_CODE_SHOW` | `false` | Show the exit code of the previous command |
|
||||
| `SPACEFISH_EXIT_CODE_PREFIX` | ` ` | Prefix of exit code |
|
||||
| `SPACEFISH_EXIT_CODE_SUFFIX` | ` ` | Suffix of exit code |
|
||||
| `SPACEFISH_EXIT_CODE_SYMBOL` | `✘` | Symbol before the exit code, upon failure |
|
||||
| `SPACEFISH_EXIT_CODE_COLOR` | `red` | Color of exit code section |
|
||||
|
||||
### Char \(`char`\)
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :--- | :---: | --- |
|
||||
| `SPACEFISH_CHAR_PREFIX` | ` ` | Prefix before prompt character |
|
||||
| `SPACEFISH_CHAR_SUFFIX` | ` ` | Suffix after prompt character |
|
||||
| `SPACEFISH_CHAR_SYMBOL` | `➜` | Prompt character to be shown before any command |
|
||||
| `SPACEFISH_CHAR_COLOR_SUCCESS` | `green` | Color of prompt character if last command completes successfully |
|
||||
| `SPACEFISH_CHAR_COLOR_FAILURE` | `red` | Color of prompt character if last command returns non-zero exit-code |
|
45
.config/fisher/github.com/matchai/spacefish/docs/README.md
Normal file
45
.config/fisher/github.com/matchai/spacefish/docs/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Summary
|
||||
|
||||
* [Home](README.md)
|
||||
* [Options](./docs/Options.md)
|
||||
* [Order](./docs/Options.md#order)
|
||||
* [Prompt](./docs/Options.md#prompt)
|
||||
* [Time](./docs/Options.md#time)
|
||||
* [Username (user)](./docs/Options.md#username-user)
|
||||
* [Directory (dir)](./docs/Options.md#directory-dir)
|
||||
* [Hostname (host)](./docs/Options.md#host-host)
|
||||
* [Git (git)](./docs/Options.md#git-git)
|
||||
* [Git branch (git_branch)](./docs/Options.md#git-branch-gitbranch)
|
||||
* [Git status (git_status)](./docs/Options.md#git-status-gitstatus)
|
||||
* [Package version (package)](./docs/Options.md#package-version-package)
|
||||
* [Node (node)](./docs/Options.md#nodejs-node)
|
||||
* [Julia (julia)](./docs/Options.md#julia-julia)
|
||||
* [Docker (docker)](./docs/Options.md#docker-docker)
|
||||
* [Ruby (ruby)](./docs/Options.md#ruby-ruby)
|
||||
* [Haskell (haskell)](./docs/Options.md#haskell-haskell)
|
||||
* [Conda (conda)](./docs/Options.md#conda-conda)
|
||||
* [Elixir (elixir)](./docs/Options.md#elixir-elixir)
|
||||
* [Amazon Web Services (aws)](./docs/Options.md#amazon-web-services-aws-aws)
|
||||
* [Pyenv (pyenv)](./docs/Options.md#pyenv-pyenv)
|
||||
* [Go (golang)](./docs/Options.md#go-golang)
|
||||
* [PHP (php)](./docs/Options.md#php-php)
|
||||
* [Rust (rust)](./docs/Options.md#rust-rust)
|
||||
* [.NET (dotnet)](/docs/Options.md#net-dotnet)
|
||||
* [Kubectl context (kubecontext)](./docs/Options.md#kubectl-context-kubecontext)
|
||||
* [Execution time (exec_time)](./docs/Options.md#execution-time-exec_time)
|
||||
* [Line Separator (line_sep)](./docs/Options.md#line_sep-node)
|
||||
* [Battery (battery)](./docs/Options.md#battery-battery)
|
||||
* [Jobs (jobs)](./docs/Options.md#jobs-jobs)
|
||||
* [Exit Code (exit_code)](./docs/Options.md#nodejs-node)
|
||||
* [Char (char)](./docs/Options.md#char)
|
||||
* [Contributing Guide](/CONTRIBUTING.md)
|
||||
* [Philosophy](/CONTRIBUTING.md#philosophy)
|
||||
* [Setup](/CONTRIBUTING.md#setup)
|
||||
* [Sections](/CONTRIBUTING.md#sections)
|
||||
* [API](/docs/API.md)
|
||||
* [Example section](/docs/API.md#typical-section)
|
||||
* [SPACEFISH_VERSION](/docs/API.md#spaceshipversion)
|
||||
* [__sf_lib_section](/docs/API.md#__sf_lib_section-color-prefix-content-suffix)
|
||||
* [__sf_util_set_default](/docs/API.md#__sf_util_set_default-variable_name-value)
|
||||
* [__sf_util_git_branch](/docs/API.md#__sf_util_git_branch)
|
||||
* [Troubleshooting](/docs/Troubleshooting.md)
|
@ -0,0 +1,82 @@
|
||||
# Troubleshooting
|
||||
|
||||
This page aimed to help you fix common problems encountered while using spacefish.
|
||||
|
||||
## My prompt is filling with errors
|
||||
|
||||
Try all of the following troubleshooting steps:
|
||||
|
||||
* Verify that your fish installation is at the [latest version](https://github.com/fish-shell/fish-shell/releases)
|
||||
|
||||
```sh
|
||||
fish --version
|
||||
```
|
||||
|
||||
* Update spacefish with `fisher` or `omf`
|
||||
|
||||
```sh
|
||||
fisher add matchai/spacefish
|
||||
# or
|
||||
omf update spacefish
|
||||
```
|
||||
|
||||
* If errors persist, please [open an issue](https://github.com/matchai/spacefish/issues/new)
|
||||
|
||||
## What's the weird symbol beside the `git` branch?
|
||||
|
||||
You need to have a powerline patched font in order to properly display `git` branch symbol.
|
||||
|
||||
* Install any powerline compatible font like [Fira Code](https://github.com/tonsky/FiraCode) or [others](https://github.com/powerline/fonts).
|
||||
* Configure your terminal emulator to [use that font](https://powerline.readthedocs.io/en/master/troubleshooting/osx.html).
|
||||
|
||||
## What's the weird character in front of a section?
|
||||
|
||||
This is not an issue with spacefish. Spacefish uses Unicode symbols to represent `SPACESFISH_*_SYMBOL` in sections. To solve this problem:
|
||||
|
||||
* Verify your terminal emulator supports Unicode characters with this command:
|
||||
|
||||
```sh
|
||||
curl https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
|
||||
# or
|
||||
wget -O - https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
|
||||
```
|
||||
* Configure your terminal emulator to use UTF-8 character encoding.
|
||||
|
||||
|
||||
In the event that Unicode characters aren't supported, you can replace them with characters that are compatible with your terminal with `SPACEFISH_*_SYMBOL` options. Check out the [Options](./docs/Options.md) page for more information.
|
||||
|
||||
## Why is my prompt slow?
|
||||
|
||||
Spacefish may run more slowlyin big repositories since the status checks add up to be expensive operations.
|
||||
|
||||
To speed up your prompt, try to reduce the number of unused spacefish sections that are enabled. Spacefish only loads the sections mentioned in `SPACEFISH_PROMPT_ORDER`. If you think some sections might not be be useful to you, you can disable them by not including their names in the prompt order.
|
||||
|
||||
## Why do my section icons overlap each other?
|
||||
|
||||

|
||||
|
||||
This issue is due to how your terminal emulator renders Unicode 9 characters. To fix this issue:
|
||||
|
||||
* Make sure terminal uses _Unicode Version 9 Widths_.
|
||||
* Let your terminal render ambiguous-width characters as double-width.
|
||||
|
||||
In _iTerm_ follow these instructions:
|
||||
|
||||
* Go _iTerm → Preferences… (⌘,) → Profiles → Text_
|
||||
* Check _Unicode Version 9 Widths_.
|
||||
* Check _Threat ambiguous-width characters as double-width_.
|
||||
* Reload your terminal's tab.
|
||||
|
||||
## Why doesn't my prompt look like it does in the preview?
|
||||
|
||||

|
||||
|
||||
Preview shows a `spacefish` setup with:
|
||||
|
||||
* [Hyper](https://hyper.is) as the terminal emulator.
|
||||
* [One Dark](https://www.npmjs.com/package/hyperterm-atom-dark) color theme from [Atom](https://atom.io/) editor.
|
||||
* [Fira Code](https://github.com/tonsky/FiraCode) with with ligatures as primary font (16px size).
|
||||
|
||||
## My problem wasn't solved
|
||||
|
||||
If the above suggestions don't address your problem, feel free to [open an issue](https://github.com/matchai/spacefish/issues/new), describe your problem and we will gladly help you.
|
@ -0,0 +1,4 @@
|
||||
function fish_mode_prompt
|
||||
# Overriden by Spacefish fishshell theme
|
||||
# To see vi mode in prompt add 'vi_mode' to SPACEFISH_PROMPT_ORDER
|
||||
end
|
33
.config/fisher/github.com/matchai/spacefish/fish_prompt.fish
Normal file
33
.config/fisher/github.com/matchai/spacefish/fish_prompt.fish
Normal file
@ -0,0 +1,33 @@
|
||||
function fish_prompt
|
||||
# Store the exit code of the last command
|
||||
set -g sf_exit_code $status
|
||||
set -g SPACEFISH_VERSION 2.6.1
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_PROMPT_ADD_NEWLINE true
|
||||
__sf_util_set_default SPACEFISH_PROMPT_FIRST_PREFIX_SHOW false
|
||||
__sf_util_set_default SPACEFISH_PROMPT_PREFIXES_SHOW true
|
||||
__sf_util_set_default SPACEFISH_PROMPT_SUFFIXES_SHOW true
|
||||
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_PREFIX "via "
|
||||
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_SUFFIX " "
|
||||
__sf_util_set_default SPACEFISH_PROMPT_ORDER time user dir host git package node ruby golang php rust haskell julia elixir docker aws venv conda pyenv dotnet kubecontext exec_time line_sep battery vi_mode jobs exit_code char
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Sections
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Keep track of whether the prompt has already been opened
|
||||
set -g sf_prompt_opened $SPACEFISH_PROMPT_FIRST_PREFIX_SHOW
|
||||
|
||||
if test "$SPACEFISH_PROMPT_ADD_NEWLINE" = "true"
|
||||
echo
|
||||
end
|
||||
|
||||
for i in $SPACEFISH_PROMPT_ORDER
|
||||
eval __sf_section_$i
|
||||
end
|
||||
set_color normal
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
function fish_right_prompt
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_RPROMPT_ORDER ""
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Sections
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ -n "$SPACEFISH_RPROMPT_ORDER" ]; or return
|
||||
|
||||
for i in $SPACEFISH_RPROMPT_ORDER
|
||||
eval __sf_section_$i
|
||||
end
|
||||
set_color normal
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
function __sf_lib_section -a color prefix content suffix
|
||||
# If there are only 2 args, they are $content and $prefix
|
||||
if test (count $argv) -eq 2
|
||||
set content $argv[2]
|
||||
set prefix
|
||||
end
|
||||
|
||||
if test "$sf_prompt_opened" = "true" -a "$SPACEFISH_PROMPT_PREFIXES_SHOW" = "true"
|
||||
# Echo prefixes in bold white
|
||||
set_color --bold
|
||||
echo -e -n -s $prefix
|
||||
set_color normal
|
||||
end
|
||||
|
||||
# Set the prompt as having been opened
|
||||
set -g sf_prompt_opened true
|
||||
|
||||
set_color --bold $color
|
||||
echo -e -n $content
|
||||
set_color normal
|
||||
|
||||
if test "$SPACEFISH_PROMPT_SUFFIXES_SHOW" = "true"
|
||||
# Echo suffixes in bold white
|
||||
set_color --bold
|
||||
echo -e -n -s $suffix
|
||||
set_color normal
|
||||
end
|
||||
end
|
@ -0,0 +1,39 @@
|
||||
#
|
||||
# Amazon Web Services (AWS)
|
||||
#
|
||||
# The AWS Command Line Interface (CLI) is a unified tool to manage AWS services.
|
||||
# Link: https://aws.amazon.com/cli/
|
||||
|
||||
function __sf_section_aws -d "Display the selected aws profile"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_AWS_SHOW true
|
||||
__sf_util_set_default SPACEFISH_AWS_PREFIX "using "
|
||||
__sf_util_set_default SPACEFISH_AWS_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_AWS_SYMBOL "☁️ "
|
||||
__sf_util_set_default SPACEFISH_AWS_COLOR ff8700
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show the selected AWS-cli profile
|
||||
[ $SPACEFISH_AWS_SHOW = false ]; and return
|
||||
|
||||
# Ensure the aws command is available
|
||||
type -q aws; or return
|
||||
|
||||
# Early return if there's no AWS_PROFILE, or it's set to default
|
||||
if test -z "$AWS_PROFILE" \
|
||||
-o "$AWS_PROFILE" = "default"
|
||||
return
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_AWS_COLOR \
|
||||
$SPACEFISH_AWS_PREFIX \
|
||||
"$SPACEFISH_AWS_SYMBOL""$AWS_PROFILE" \
|
||||
$SPACEFISH_AWS_SUFFIX
|
||||
end
|
@ -0,0 +1,114 @@
|
||||
#
|
||||
# Battery
|
||||
#
|
||||
|
||||
function __sf_section_battery -d "Displays battery symbol and charge"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# | SPACEFISH_BATTERY_SHOW | below threshold | above threshold | fully charged |
|
||||
# |------------------------+-----------------+-----------------+---------------|
|
||||
# | false | hidden | hidden | hidden |
|
||||
# | always | shown | shown | shown |
|
||||
# | true | shown | hidden | hidden |
|
||||
# | charged | shown | hidden | shown |
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_BATTERY_SHOW true
|
||||
__sf_util_set_default SPACEFISH_BATTERY_PREFIX ""
|
||||
__sf_util_set_default SPACEFISH_BATTERY_SUFFIX " "
|
||||
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_CHARGING ⇡
|
||||
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_DISCHARGING ⇣
|
||||
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_FULL •
|
||||
__sf_util_set_default SPACEFISH_BATTERY_THRESHOLD 10
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show section only if any of the following is true
|
||||
# - SPACEFISH_BATTERY_SHOW = "always"
|
||||
# - SPACEFISH_BATTERY_SHOW = "true" and
|
||||
# - battery percentage is below the given limit (default: 10%)
|
||||
# - SPACEFISH_BATTERY_SHOW = "charged" and
|
||||
# - Battery is fully charged
|
||||
|
||||
# Check that user wants to show battery levels
|
||||
[ $SPACEFISH_BATTERY_SHOW = false ]; and return
|
||||
|
||||
set -l battery_data
|
||||
set -l battery_percent
|
||||
set -l battery_status
|
||||
set -l battery_color
|
||||
set -l battery_symbol
|
||||
|
||||
# Darwin and macOS machines
|
||||
if type -q pmset
|
||||
set battery_data (pmset -g batt | grep "InternalBattery")
|
||||
|
||||
# Return if no internal battery
|
||||
if test -z (echo $battery_data)
|
||||
return
|
||||
end
|
||||
|
||||
set battery_percent (echo $battery_data | grep -oE "[0-9]{1,3}%")
|
||||
# spaceship has echo $battery_data | awk -F '; *' 'NR==2 { print $2 }', but NR==2 did not return anything.
|
||||
set battery_status (echo $battery_data | awk -F '; *' '{ print $2 }')
|
||||
|
||||
# Linux machines
|
||||
else if type -q upower
|
||||
set -l battery (upower -e | grep battery | head -1)
|
||||
|
||||
[ -z $battery ]; and return
|
||||
|
||||
set -l IFS # Clear IFS to allow for multi-line variables
|
||||
set battery_data (upower -i $battery)
|
||||
set battery_percent (echo $battery_data | grep percentage | awk '{print $2}')
|
||||
set battery_status (echo $battery_data | grep state | awk '{print $2}')
|
||||
|
||||
# Windows machines.
|
||||
else if type -q acpi
|
||||
set -l battery_data (acpi -b 2>/dev/null | head -1)
|
||||
|
||||
# Return if no battery
|
||||
[ -z $battery_data ]; and return
|
||||
|
||||
set battery_percent ( echo $battery_data | awk '{print $4}' )
|
||||
set battery_status ( echo $battery_data | awk '{print tolower($3)}' )
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
# Remove trailing % and symbols for comparison
|
||||
set battery_percent (echo $battery_percent | string trim --chars=%[,;])
|
||||
|
||||
if test "$battery_percent" -eq 100 -o -n (echo (string match -r "(charged|full)" $battery_status))
|
||||
set battery_color green
|
||||
else if test "$battery_percent" -lt "$SPACEFISH_BATTERY_THRESHOLD"
|
||||
set battery_color red
|
||||
else
|
||||
set battery_color yellow
|
||||
end
|
||||
|
||||
# Battery indicator based on current status of battery
|
||||
if test "$battery_status" = "charging"
|
||||
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_CHARGING
|
||||
else if test -n (echo (string match -r "^[dD]ischarg.*" $battery_status))
|
||||
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_DISCHARGING
|
||||
else
|
||||
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_FULL
|
||||
end
|
||||
|
||||
if test "$SPACEFISH_BATTERY_SHOW" = "always" \
|
||||
-o "$battery_percent" -lt "$SPACEFISH_BATTERY_THRESHOLD" \
|
||||
-o "$SPACEFISH_BATTERY_SHOW" = "charged" \
|
||||
-a -n (echo (string match -r "(charged|full)" $battery_status))
|
||||
__sf_lib_section \
|
||||
$battery_color \
|
||||
$SPACEFISH_BATTERY_PREFIX \
|
||||
"$battery_symbol$battery_percent%" \
|
||||
$SPACEFISH_BATTERY_SUFFIX
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Prompt character
|
||||
#
|
||||
|
||||
function __sf_section_char -d "Display the prompt character"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_CHAR_PREFIX ""
|
||||
__sf_util_set_default SPACEFISH_CHAR_SUFFIX " "
|
||||
__sf_util_set_default SPACEFISH_CHAR_SYMBOL ➜
|
||||
__sf_util_set_default SPACEFISH_CHAR_COLOR_SUCCESS green
|
||||
__sf_util_set_default SPACEFISH_CHAR_COLOR_FAILURE red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Color $SPACEFISH_CHAR_SYMBOL red if previous command failed and
|
||||
# color it in green if the command succeeded.
|
||||
set -l color
|
||||
|
||||
if test $sf_exit_code -eq 0
|
||||
set color $SPACEFISH_CHAR_COLOR_SUCCESS
|
||||
else
|
||||
set color $SPACEFISH_CHAR_COLOR_FAILURE
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$color \
|
||||
$SPACEFISH_CHAR_PREFIX \
|
||||
$SPACEFISH_CHAR_SYMBOL \
|
||||
$SPACEFISH_CHAR_SUFFIX
|
||||
end
|
@ -0,0 +1,36 @@
|
||||
#
|
||||
# Conda
|
||||
#
|
||||
# Current Conda version.
|
||||
|
||||
function __sf_section_conda -d "Display current Conda version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_CONDA_SHOW true
|
||||
__sf_util_set_default SPACEFISH_CONDA_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_CONDA_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_CONDA_SYMBOL "🅒 "
|
||||
__sf_util_set_default SPACEFISH_CONDA_COLOR blue
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_CONDA_SHOW = false ]; and return
|
||||
|
||||
# Show Conda version only if conda is installed and CONDA_DEFAULT_ENV is set
|
||||
if not type -q conda; \
|
||||
or test -z "$CONDA_DEFAULT_ENV";
|
||||
return
|
||||
end
|
||||
|
||||
set -l conda_version (conda -V | string split ' ')[2]
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_CONDA_COLOR \
|
||||
$SPACEFISH_CONDA_PREFIX \
|
||||
"$SPACEFISH_CONDA_SYMBOL"v"$conda_version" \
|
||||
$SPACEFISH_CONDA_SUFFIX
|
||||
end
|
@ -0,0 +1,54 @@
|
||||
#
|
||||
# Working directory
|
||||
#
|
||||
|
||||
function __sf_section_dir -d "Display the current truncated directory"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_DIR_SHOW true
|
||||
__sf_util_set_default SPACEFISH_DIR_PREFIX "in "
|
||||
__sf_util_set_default SPACEFISH_DIR_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_DIR_TRUNC 3
|
||||
__sf_util_set_default SPACEFISH_DIR_TRUNC_REPO true
|
||||
__sf_util_set_default SPACEFISH_DIR_COLOR cyan
|
||||
|
||||
# Write Permissions lock symbol
|
||||
__sf_util_set_default SPACEFISH_DIR_LOCK_SHOW true
|
||||
__sf_util_set_default SPACEFISH_DIR_LOCK_SYMBOL ""
|
||||
__sf_util_set_default SPACEFISH_DIR_LOCK_COLOR red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_DIR_SHOW = false ]; and return
|
||||
|
||||
set -l dir
|
||||
set -l tmp
|
||||
set -l git_root (command git rev-parse --show-toplevel 2>/dev/null)
|
||||
|
||||
if test "$SPACEFISH_DIR_TRUNC_REPO" = "true" -a -n "$git_root"
|
||||
# Resolve to physical PWD instead of logical
|
||||
set -l resolvedPWD (pwd -P 2>/dev/null; or pwd)
|
||||
# Treat repo root as top level directory
|
||||
set tmp (string replace $git_root (basename $git_root) $resolvedPWD)
|
||||
else
|
||||
set -l realhome ~
|
||||
set tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
|
||||
end
|
||||
|
||||
# Truncate the path to have a limited number of dirs
|
||||
set dir (__sf_util_truncate_dir $tmp $SPACEFISH_DIR_TRUNC)
|
||||
|
||||
if [ $SPACEFISH_DIR_LOCK_SHOW = true -a ! -w . ]
|
||||
set DIR_LOCK_SYMBOL (set_color $SPACEFISH_DIR_LOCK_COLOR)" $SPACEFISH_DIR_LOCK_SYMBOL"(set_color --bold)
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_DIR_COLOR \
|
||||
$SPACEFISH_DIR_PREFIX \
|
||||
$dir \
|
||||
"$DIR_LOCK_SYMBOL""$SPACEFISH_DIR_SUFFIX"
|
||||
end
|
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Docker
|
||||
#
|
||||
# Current Docker version and Machine name.
|
||||
|
||||
function __sf_section_docker -d "Display docker version and machine name"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_DOCKER_SHOW true
|
||||
__sf_util_set_default SPACEFISH_DOCKER_PREFIX "is "
|
||||
__sf_util_set_default SPACEFISH_DOCKER_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_DOCKER_SYMBOL "🐳 "
|
||||
__sf_util_set_default SPACEFISH_DOCKER_COLOR cyan
|
||||
__sf_util_set_default SPACEFISH_DOCKER_VERBOSE_VERSION false
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_DOCKER_SHOW = false ]; and return
|
||||
|
||||
# Show Docker version only if docker is installed
|
||||
type -q docker; or return
|
||||
|
||||
# Show docker version only when pwd has Dockerfile, docker-compose.yml, .dockerenv in root or COMPOSE_FILE
|
||||
if not test -f Dockerfile \
|
||||
-o -f docker-compose.yml \
|
||||
-o -f /.dockerenv \
|
||||
-o -f "$COMPOSE_FILE"
|
||||
return
|
||||
end
|
||||
|
||||
set -l docker_version (docker version -f "{{.Server.Version}}" 2>/dev/null)
|
||||
# if docker daemon isn't running you'll get an error like 'Bad response from Docker engine'
|
||||
[ -z $docker_version ]; and return
|
||||
|
||||
if test "$SPACEFISH_DOCKER_VERBOSE_VERSION" = "false"
|
||||
set docker_version (string split - $docker_version)[1]
|
||||
end
|
||||
|
||||
if test -n "$DOCKER_MACHINE_NAME"
|
||||
set docker_version $docker_version via $DOCKER_MACHINE_NAME
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_DOCKER_COLOR \
|
||||
$SPACEFISH_DOCKER_PREFIX \
|
||||
"$SPACEFISH_DOCKER_SYMBOL"v"$docker_version" \
|
||||
$SPACEFISH_DOCKER_SUFFIX
|
||||
end
|
@ -0,0 +1,50 @@
|
||||
#
|
||||
# .NET
|
||||
#
|
||||
# .NET Framework is a software framework developed by Microsoft.
|
||||
# It includes a large class library and provides language interoperability
|
||||
# across several programming languages.
|
||||
# Link: https://www.microsoft.com/net
|
||||
|
||||
function __sf_section_dotnet -d "Display the .NET SDK version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_DOTNET_SHOW true
|
||||
__sf_util_set_default SPACEFISH_DOTNET_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_DOTNET_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_DOTNET_SYMBOL ".NET "
|
||||
__sf_util_set_default SPACEFISH_DOTNET_COLOR "af00d7" # 128 in the original version, but renders as blue in iTerm2?
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show current version of .NET SDK
|
||||
[ $SPACEFISH_DOTNET_SHOW = false ]; and return
|
||||
|
||||
# Ensure the dotnet command is available
|
||||
type -q dotnet; or return
|
||||
|
||||
if not test -f project.json \
|
||||
-o -f global.json \
|
||||
-o -f paket.dependencies \
|
||||
-o (count *.csproj) -gt 0 \
|
||||
-o (count *.fsproj) -gt 0 \
|
||||
-o (count *.xproj) -gt 0 \
|
||||
-o (count *.sln) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
# From the
|
||||
# dotnet-cli automatically handles SDK pinning (specified in a global.json file)
|
||||
# therefore, this already returns the expected version for the current directory
|
||||
set -l dotnet_version (dotnet --version 2>/dev/null)
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_DOTNET_COLOR \
|
||||
$SPACEFISH_DOTNET_PREFIX \
|
||||
"$SPACEFISH_DOTNET_SYMBOL""$dotnet_version" \
|
||||
$SPACEFISH_DOTNET_SUFFIX
|
||||
end
|
@ -0,0 +1,57 @@
|
||||
#
|
||||
# Elixir
|
||||
#
|
||||
# A dynamic, reflective, object-oriented, general-purpose programming language.
|
||||
# Link: https://www.elixir-lang.org/
|
||||
|
||||
function __sf_section_elixir -d "Show current version of Elixir"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_SHOW true
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_SYMBOL "💧 "
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_DEFAULT_VERSION $SPACEFISH_ELIXIR_DEFAULT_VERSION
|
||||
__sf_util_set_default SPACEFISH_ELIXIR_COLOR magenta
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Check if that user wants to show elixir version
|
||||
[ $SPACEFISH_ELIXIR_SHOW = false ]; and return
|
||||
|
||||
# Show versions only for Elixir-specific folders
|
||||
if not test -f mix.exs \
|
||||
-o (count *.ex) -gt 0 \
|
||||
-o (count *.exs) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
set -l elixir_version
|
||||
|
||||
if type -q kiex
|
||||
set elixir_version $ELIXIR_VERSION
|
||||
else if type -q exenv
|
||||
set elixir_version (exenv version-name)
|
||||
else if type -q elixir
|
||||
set elixir_version (elixir -v 2>/dev/null | string match -r "Elixir.*" | string split " ")[2]
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
[ -z "$elixir_version" -o "$elixir_version" = "system" ]; and return
|
||||
|
||||
# Add 'v' before elixir version that starts with a number
|
||||
if test -n (echo (string match -r "^[0-9].+\$" "$elixir_version"))
|
||||
set elixir_version "v$elixir_version"
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_ELIXIR_COLOR \
|
||||
$SPACEFISH_ELIXIR_PREFIX \
|
||||
"$SPACEFISH_ELIXIR_SYMBOL""$elixir_version" \
|
||||
$SPACEFISH_ELIXIR_SUFFIX
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Execution time
|
||||
#
|
||||
|
||||
function __sf_section_exec_time -d "Display the execution time of the last command"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_EXEC_TIME_SHOW true
|
||||
__sf_util_set_default SPACEFISH_EXEC_TIME_PREFIX "took "
|
||||
__sf_util_set_default SPACEFISH_EXEC_TIME_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_EXEC_TIME_COLOR yellow
|
||||
__sf_util_set_default SPACEFISH_EXEC_TIME_ELAPSED 5
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_EXEC_TIME_SHOW = false ]; and return
|
||||
|
||||
# Allow for compatibility between fish 2.7 and 3.0
|
||||
set -l command_duration "$CMD_DURATION$cmd_duration"
|
||||
|
||||
if test -n "$command_duration" -a "$command_duration" -gt (math "$SPACEFISH_EXEC_TIME_ELAPSED * 1000")
|
||||
set -l human_command_duration (echo $command_duration | __sf_util_human_time)
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_EXEC_TIME_COLOR \
|
||||
$SPACEFISH_EXEC_TIME_PREFIX \
|
||||
$human_command_duration \
|
||||
$SPACEFISH_EXEC_TIME_SUFFIX
|
||||
end
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
# Exit-code
|
||||
#
|
||||
|
||||
function __sf_section_exit_code -d "Shows the exit code from the previous command."
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_EXIT_CODE_SHOW false
|
||||
__sf_util_set_default SPACEFISH_EXIT_CODE_PREFIX ""
|
||||
__sf_util_set_default SPACEFISH_EXIT_CODE_SUFFIX " "
|
||||
__sf_util_set_default SPACEFISH_EXIT_CODE_SYMBOL ✘
|
||||
__sf_util_set_default SPACEFISH_EXIT_CODE_COLOR red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_EXIT_CODE_SHOW = false ]; or test $sf_exit_code -eq 0; and return
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_EXIT_CODE_COLOR \
|
||||
$SPACEFISH_EXIT_CODE_PREFIX \
|
||||
"$SPACEFISH_EXIT_CODE_SYMBOL$sf_exit_code" \
|
||||
$SPACEFISH_EXIT_CODE_SUFFIX
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Git
|
||||
#
|
||||
|
||||
function __sf_section_git -d "Display the git branch and status"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_GIT_SHOW true
|
||||
__sf_util_set_default SPACEFISH_GIT_PREFIX "on "
|
||||
__sf_util_set_default SPACEFISH_GIT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_GIT_SYMBOL " "
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show both git branch and git status:
|
||||
# spacefish_git_branch
|
||||
# spacefish_git_status
|
||||
|
||||
[ $SPACEFISH_GIT_SHOW = false ]; and return
|
||||
|
||||
set -l git_branch (__sf_section_git_branch)
|
||||
set -l git_status (__sf_section_git_status)
|
||||
|
||||
[ -z $git_branch ]; and return
|
||||
|
||||
__sf_lib_section \
|
||||
fff \
|
||||
$SPACEFISH_GIT_PREFIX \
|
||||
"$git_branch$git_status" \
|
||||
$SPACEFISH_GIT_SUFFIX
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Git branch
|
||||
#
|
||||
|
||||
function __sf_section_git_branch -d "Format the displayed branch name"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_GIT_BRANCH_SHOW true
|
||||
__sf_util_set_default SPACEFISH_GIT_BRANCH_PREFIX $SPACEFISH_GIT_SYMBOL
|
||||
__sf_util_set_default SPACEFISH_GIT_BRANCH_SUFFIX ""
|
||||
__sf_util_set_default SPACEFISH_GIT_BRANCH_COLOR magenta
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_GIT_BRANCH_SHOW = false ]; and return
|
||||
|
||||
set -l git_branch (__sf_util_git_branch)
|
||||
|
||||
[ -z $git_branch ]; and return
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_GIT_BRANCH_COLOR \
|
||||
$SPACEFISH_GIT_BRANCH_PREFIX$git_branch$SPACEFISH_GIT_BRANCH_SUFFIX
|
||||
end
|
@ -0,0 +1,100 @@
|
||||
#
|
||||
# Git status
|
||||
#
|
||||
|
||||
function __sf_section_git_status -d "Display the current git status"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_SHOW true
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_PREFIX " ["
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_SUFFIX ]
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_COLOR red
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_UNTRACKED \?
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_ADDED +
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_MODIFIED !
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_RENAMED »
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_DELETED ✘
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_STASHED \$
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_UNMERGED =
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_AHEAD ⇡
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_BEHIND ⇣
|
||||
__sf_util_set_default SPACEFISH_GIT_STATUS_DIVERGED ⇕
|
||||
__sf_util_set_default SPACEFISH_GIT_PROMPT_ORDER untracked added modified renamed deleted stashed unmerged diverged ahead behind
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_GIT_STATUS_SHOW = false ]; and return
|
||||
|
||||
set -l git_status
|
||||
set -l is_ahead
|
||||
set -l is_behind
|
||||
|
||||
set -l index (command git status --porcelain 2>/dev/null -b)
|
||||
set -l trimmed_index (string split \n $index | string sub --start 1 --length 2)
|
||||
|
||||
for i in $trimmed_index
|
||||
if test (string match '\?\?' $i)
|
||||
set git_status untracked $git_status
|
||||
end
|
||||
if test (string match '*A*' $i)
|
||||
set git_status added $git_status
|
||||
end
|
||||
if test (string match '*M*' $i)
|
||||
set git_status modified $git_status
|
||||
end
|
||||
if test (string match '*R*' $i)
|
||||
set git_status renamed $git_status
|
||||
end
|
||||
if test (string match '*D*' $i)
|
||||
set git_status deleted $git_status
|
||||
end
|
||||
if test (string match '*U*' $i)
|
||||
set git_status unmerged $git_status
|
||||
end
|
||||
end
|
||||
|
||||
# Check for stashes
|
||||
if test -n (echo (command git rev-parse --verify refs/stash 2>/dev/null))
|
||||
set git_status stashed $git_status
|
||||
end
|
||||
|
||||
# Check whether the branch is ahead
|
||||
if test (string match '*ahead*' $index)
|
||||
set is_ahead true
|
||||
end
|
||||
|
||||
# Check whether the branch is behind
|
||||
if test (string match '*behind*' $index)
|
||||
set is_behind true
|
||||
end
|
||||
|
||||
# Check whether the branch has diverged
|
||||
if test "$is_ahead" = "true" -a "$is_behind" = "true"
|
||||
set git_status diverged $git_status
|
||||
else if test "$is_ahead" = "true"
|
||||
set git_status ahead $git_status
|
||||
else if test "$is_behind" = "true"
|
||||
set git_status behind $git_status
|
||||
end
|
||||
|
||||
set -l full_git_status
|
||||
for i in $SPACEFISH_GIT_PROMPT_ORDER
|
||||
set i (string upper $i)
|
||||
set git_status (string upper $git_status)
|
||||
if contains $i in $git_status
|
||||
set -l status_symbol SPACEFISH_GIT_STATUS_$i
|
||||
set full_git_status "$$status_symbol$full_git_status"
|
||||
end
|
||||
end
|
||||
|
||||
# Check if git status
|
||||
if test -n "$full_git_status"
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_GIT_STATUS_COLOR \
|
||||
"$SPACEFISH_GIT_STATUS_PREFIX$full_git_status$SPACEFISH_GIT_STATUS_SUFFIX"
|
||||
end
|
||||
end
|
@ -0,0 +1,55 @@
|
||||
#
|
||||
# Go
|
||||
#
|
||||
# Go is an open source programming language that makes it easy
|
||||
# to build efficient software.
|
||||
# Link: https://golang.org/
|
||||
|
||||
function __sf_section_golang -d "Display the current go version if you're inside GOPATH"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_GOLANG_SHOW true
|
||||
__sf_util_set_default SPACEFISH_GOLANG_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_GOLANG_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_GOLANG_SYMBOL "🐹 "
|
||||
__sf_util_set_default SPACEFISH_GOLANG_COLOR cyan
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show the current version of Golang
|
||||
[ $SPACEFISH_GOLANG_SHOW = false ]; and return
|
||||
|
||||
# Ensure the go command is available
|
||||
type -q go; or return
|
||||
|
||||
if not test -f go.mod \
|
||||
-o -d Godeps \
|
||||
-o -f glide.yaml \
|
||||
-o (count *.go) -gt 0 \
|
||||
-o -f Gopkg.yml \
|
||||
-o -f Gopkg.lock \
|
||||
-o ([ (count $GOPATH) -gt 0 ]; and string match $GOPATH $PWD)
|
||||
return
|
||||
end
|
||||
|
||||
set -l go_version (go version | string split ' ')
|
||||
|
||||
# Go version is either the commit hash and date (devel +5efe9a8f11 Web Jan 9 07:21:16 2019 +0000)
|
||||
# at the time of the build or a release tag (go1.11.4)
|
||||
# https://github.com/matchai/spacefish/issues/137
|
||||
if test (string match 'devel*' $go_version[3])
|
||||
set go_version $go_version[3]":"(string sub -s 2 $go_version[4])
|
||||
else
|
||||
set go_version "v"(string sub -s 3 $go_version[3])
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_GOLANG_COLOR \
|
||||
$SPACEFISH_GOLANG_PREFIX \
|
||||
"$SPACEFISH_GOLANG_SYMBOL""$go_version" \
|
||||
$SPACEFISH_GOLANG_SUFFIX
|
||||
end
|
@ -0,0 +1,38 @@
|
||||
#
|
||||
# Haskell Stack
|
||||
#
|
||||
# An advanced, purely functional programming language.
|
||||
# Link: https://www.haskell.org/
|
||||
|
||||
function __sf_section_haskell -d "Show current version of Haskell Tool Stack"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_HASKELL_SHOW true
|
||||
__sf_util_set_default SPACEFISH_HASKELL_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_HASKELL_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_HASKELL_SYMBOL "λ "
|
||||
__sf_util_set_default SPACEFISH_HASKELL_COLOR red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show current version of Haskell Tool Stack.
|
||||
[ $SPACEFISH_HASKELL_SHOW = false ]; and return
|
||||
|
||||
# Ensure the stack command is available
|
||||
type -q stack; or return
|
||||
|
||||
# If there are stack files in current directory
|
||||
[ -f ./stack.yaml ]; or return
|
||||
|
||||
set -l haskell_version (stack ghc -- --numeric-version --no-install-ghc)
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_HASKELL_COLOR \
|
||||
$SPACEFISH_HASKELL_PREFIX \
|
||||
"$SPACEFISH_HASKELL_SYMBOL"v"$haskell_version" \
|
||||
$SPACEFISH_HASKELL_SUFFIX
|
||||
end
|
@ -0,0 +1,41 @@
|
||||
#
|
||||
# Hostname
|
||||
#
|
||||
|
||||
|
||||
# If there is an ssh connections, current machine name.
|
||||
function __sf_section_host -d "Display the current hostname if connected over SSH"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_HOST_SHOW true
|
||||
__sf_util_set_default SPACEFISH_HOST_PREFIX "at "
|
||||
__sf_util_set_default SPACEFISH_HOST_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_HOST_COLOR blue
|
||||
__sf_util_set_default SPACEFISH_HOST_COLOR_SSH green
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ "$SPACEFISH_HOST_SHOW" = false ]; and return
|
||||
|
||||
if test "$SPACEFISH_HOST_SHOW" = "always"; or set -q SSH_CONNECTION;
|
||||
|
||||
# Determination of what color should be used
|
||||
set -l host_color
|
||||
if set -q SSH_CONNECTION;
|
||||
set host_color $SPACEFISH_HOST_COLOR_SSH
|
||||
else
|
||||
set host_color $SPACEFISH_HOST_COLOR
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$host_color \
|
||||
$SPACEFISH_HOST_PREFIX \
|
||||
(hostname) \
|
||||
$SPACEFISH_HOST_SUFFIX
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
# Jobs
|
||||
#
|
||||
|
||||
function __sf_section_jobs -d "Show icon, if there's a working jobs in the background."
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_JOBS_SHOW true
|
||||
__sf_util_set_default SPACEFISH_JOBS_PREFIX ""
|
||||
__sf_util_set_default SPACEFISH_JOBS_SUFFIX " "
|
||||
__sf_util_set_default SPACEFISH_JOBS_SYMBOL ✦
|
||||
__sf_util_set_default SPACEFISH_JOBS_COLOR blue
|
||||
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_PREFIX ""
|
||||
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_SUFFIX ""
|
||||
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_THRESHOLD 1
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_JOBS_SHOW = false ]; and return
|
||||
|
||||
set jobs_amount (jobs | wc -l | xargs) # Zsh had a much more complicated command.
|
||||
|
||||
if test $jobs_amount -eq 0
|
||||
return
|
||||
end
|
||||
|
||||
if test $jobs_amount -le $SPACEFISH_JOBS_AMOUNT_THRESHOLD
|
||||
set jobs_amount ''
|
||||
set SPACEFISH_JOBS_AMOUNT_PREFIX ''
|
||||
set SPACEFISH_JOBS_AMOUNT_SUFFIX ''
|
||||
end
|
||||
|
||||
set SPACEFISH_JOBS_SECTION "$SPACEFISH_JOBS_SYMBOL$SPACEFISH_JOBS_AMOUNT_PREFIX$jobs_amount$SPACEFISH_JOBS_AMOUNT_SUFFIX"
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_JOBS_COLOR \
|
||||
$SPACEFISH_JOBS_PREFIX \
|
||||
$SPACEFISH_JOBS_SECTION \
|
||||
$SPACEFISH_JOBS_SUFFIX
|
||||
end
|
@ -0,0 +1,36 @@
|
||||
#
|
||||
# Julia
|
||||
#
|
||||
# Current Julia version.
|
||||
|
||||
function __sf_section_julia -d "Display julia version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_JULIA_SHOW true
|
||||
__sf_util_set_default SPACEFISH_JULIA_PREFIX "is "
|
||||
__sf_util_set_default SPACEFISH_JULIA_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_JULIA_SYMBOL "ஃ "
|
||||
__sf_util_set_default SPACEFISH_JULIA_COLOR green
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_JULIA_SHOW = false ]; and return
|
||||
|
||||
# Show Julia version only if julia is installed
|
||||
type -q julia; or return
|
||||
|
||||
# Show julia version only when pwd has *.jl file(s)
|
||||
[ (count *.jl) -gt 0 ]; or return
|
||||
|
||||
set -l julia_version (julia --version | grep --color=never -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]')
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_JULIA_COLOR \
|
||||
$SPACEFISH_JULIA_PREFIX \
|
||||
"$SPACEFISH_JULIA_SYMBOL"v"$julia_version" \
|
||||
$SPACEFISH_JULIA_SUFFIX
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Kubernetes (kubectl)
|
||||
#
|
||||
# Kubernetes is an open-source system for deployment, scaling,
|
||||
# and management of containerized applications.
|
||||
# Link: https://kubernetes.io/
|
||||
|
||||
function __sf_section_kubecontext -d "Display the kubernetes context"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_SHOW true
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW true
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_PREFIX "at "
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
# Additional space is added because ☸️ is wider than other symbols
|
||||
# See: https://github.com/denysdovhan/spaceship-prompt/pull/432
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_SYMBOL "☸️ "
|
||||
__sf_util_set_default SPACEFISH_KUBECONTEXT_COLOR cyan
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show current kubecontext
|
||||
[ $SPACEFISH_KUBECONTEXT_SHOW = false ]; and return
|
||||
# Ensure the kubectl command is available
|
||||
type -q kubectl; or return
|
||||
|
||||
set -l kube_context (kubectl config current-context 2>/dev/null)
|
||||
[ -z $kube_context ]; and return
|
||||
|
||||
if test "$SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW" = "true" -a "$kube_context" != "default"
|
||||
set kube_namespace (kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
|
||||
set kube_context "$kube_context ($kube_namespace)"
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_KUBECONTEXT_COLOR \
|
||||
$SPACEFISH_KUBECONTEXT_PREFIX \
|
||||
"$SPACEFISH_KUBECONTEXT_SYMBOL""$kube_context" \
|
||||
$SPACEFISH_KUBECONTEXT_SUFFIX
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Line separator
|
||||
#
|
||||
|
||||
function __sf_section_line_sep -d "Separate the prompt into two lines"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_PROMPT_SEPARATE_LINE true
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "$SPACEFISH_PROMPT_SEPARATE_LINE" = "true"
|
||||
echo -e -n \n
|
||||
end
|
||||
end
|
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Node.js
|
||||
#
|
||||
# Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
|
||||
# Link: https://nodejs.org/
|
||||
|
||||
function __sf_section_node -d "Display the local node version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_NODE_SHOW true
|
||||
__sf_util_set_default SPACEFISH_NODE_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_NODE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_NODE_SYMBOL "⬢ "
|
||||
__sf_util_set_default SPACEFISH_NODE_DEFAULT_VERSION ""
|
||||
__sf_util_set_default SPACEFISH_NODE_COLOR green
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show the current version of Node
|
||||
[ $SPACEFISH_NODE_SHOW = false ]; and return
|
||||
|
||||
# Show versions only for Node-specific folders
|
||||
if not test -f ./package.json \
|
||||
-o -d ./node_modules \
|
||||
-o (count *.js) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
if type -q nvm
|
||||
# Only recheck the node version if the nvm bin has changed
|
||||
if test "$NVM_BIN" != "$sf_last_nvm_bin" -o -z "$sf_node_version"
|
||||
set -g sf_node_version (nvm current 2>/dev/null)
|
||||
set -g sf_last_nvm_bin $NVM_BIN
|
||||
end
|
||||
else if type -q nodenv
|
||||
set -g sf_node_version (nodenv version-name 2>/dev/null)
|
||||
else if type -q node
|
||||
set -g sf_node_version (node -v 2>/dev/null)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
# Don't echo section if the system verison of node is being used
|
||||
[ "$sf_node_version" = "system" -o "$sf_node_version" = "node" ]; and return
|
||||
|
||||
# Don't echo section if the node version matches the default version
|
||||
[ "$sf_node_version" = "$SPACEFISH_NODE_DEFAULT_VERSION" ]; and return
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_NODE_COLOR \
|
||||
$SPACEFISH_NODE_PREFIX \
|
||||
"$SPACEFISH_NODE_SYMBOL$sf_node_version" \
|
||||
$SPACEFISH_NODE_SUFFIX
|
||||
end
|
@ -0,0 +1,72 @@
|
||||
#
|
||||
# Package
|
||||
#
|
||||
# Current package version.
|
||||
# These package managers supported:
|
||||
# * NPM
|
||||
# * Cargo
|
||||
|
||||
function __sf_section_package -d "Display the local package version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_PACKAGE_SHOW true
|
||||
__sf_util_set_default SPACEFISH_PACKAGE_PREFIX "is "
|
||||
__sf_util_set_default SPACEFISH_PACKAGE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_PACKAGE_SYMBOL "📦 "
|
||||
__sf_util_set_default SPACEFISH_PACKAGE_COLOR red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_PACKAGE_SHOW = false ]; and return
|
||||
|
||||
# Exit if there is no package.json or Cargo.toml
|
||||
if not test -e ./package.json; and not test -e ./Cargo.toml
|
||||
return
|
||||
end
|
||||
|
||||
set -l package_version
|
||||
|
||||
# Check if package.json exists AND npm exists locally while supressing output to just exit code (-q)
|
||||
if type -q npm; and test -f ./package.json
|
||||
# Check if jq (json handler) exists locally. If yes, check in package.json version
|
||||
if type -q jq
|
||||
set package_version (jq -r '.version' package.json 2>/dev/null)
|
||||
# Check if python exists locally, use json to check version in package.json
|
||||
else if type -q python
|
||||
set package_version (python -c "import json; print(json.load(open('package.json'))['version'])" 2>/dev/null)
|
||||
# Check if node exists locally, use it to check version of package.json
|
||||
else if type -q node
|
||||
set package_version (node -p "require('./package.json').version" 2>/dev/null)
|
||||
end
|
||||
end
|
||||
|
||||
# Check if Cargo.toml exists and cargo command exists
|
||||
# and use cargo pkgid to figure out the package
|
||||
if type -q cargo; and test -f ./Cargo.toml
|
||||
# Handle missing field `version` in Cargo.toml.
|
||||
# `cargo pkgid` needs Cargo.lock to exists too. If
|
||||
# it doesn't, do not show package version
|
||||
set -l pkgid (cargo pkgid 2>&1)
|
||||
# Early return on error
|
||||
echo $pkgid | grep -q "error:"; and return
|
||||
|
||||
# Example input: abc#1.0.0. Example output: 1.0.1
|
||||
set package_version (string match -r '#(.*)' $pkgid)[2]
|
||||
end
|
||||
|
||||
if test -z "$package_version"
|
||||
set package_version ⚠
|
||||
else
|
||||
set package_version "v$package_version"
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_PACKAGE_COLOR \
|
||||
$SPACEFISH_PACKAGE_PREFIX \
|
||||
"$SPACEFISH_PACKAGE_SYMBOL$package_version" \
|
||||
$SPACEFISH_PACKAGE_SUFFIX
|
||||
end
|
@ -0,0 +1,40 @@
|
||||
#
|
||||
# PHP
|
||||
#
|
||||
# PHP is a server-side scripting language designed primarily for web development.
|
||||
# Link: http://www.php.net/
|
||||
|
||||
function __sf_section_php -d "Display the current php version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_PHP_SHOW true
|
||||
__sf_util_set_default SPACEFISH_PHP_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_PHP_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_PHP_SYMBOL "🐘 "
|
||||
__sf_util_set_default SPACEFISH_PHP_COLOR blue
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show current version of PHP
|
||||
[ $SPACEFISH_PHP_SHOW = false ]; and return
|
||||
|
||||
# Ensure the php command is available
|
||||
type -q php; or return
|
||||
|
||||
if not test -f composer.json \
|
||||
-o (count *.php) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
set -l php_version (php -v | string match -r 'PHP\s*[0-9.]+' | string split ' ')[2]
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_PHP_COLOR \
|
||||
$SPACEFISH_PHP_PREFIX \
|
||||
"$SPACEFISH_PHP_SYMBOL"v"$php_version" \
|
||||
$SPACEFISH_PHP_SUFFIX
|
||||
end
|
@ -0,0 +1,41 @@
|
||||
# pyenv
|
||||
#
|
||||
|
||||
function __sf_section_pyenv -d "Show current version of pyenv Python, including system."
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_PYENV_SHOW true
|
||||
__sf_util_set_default SPACEFISH_PYENV_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_PYENV_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_PYENV_SYMBOL "🐍 "
|
||||
__sf_util_set_default SPACEFISH_PYENV_COLOR yellow
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show pyenv python version
|
||||
[ $SPACEFISH_PYENV_SHOW = false ]; and return
|
||||
|
||||
# Ensure the pyenv command is available
|
||||
type -q pyenv; or return
|
||||
|
||||
# Show pyenv python version only for Python-specific folders
|
||||
if not test -n "$PYENV_VERSION" \
|
||||
-o -f .python-version \
|
||||
-o -f requirements.txt \
|
||||
-o -f pyproject.toml \
|
||||
-o (count *.py) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
set -l pyenv_status (pyenv version-name 2>/dev/null) # This line needs explicit testing in an enviroment that has pyenv.
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_PYENV_COLOR \
|
||||
$SPACEFISH_PYENV_PREFIX \
|
||||
"$SPACEFISH_PYENV_SYMBOL""$pyenv_status" \
|
||||
$SPACEFISH_PYENV_SUFFIX
|
||||
end
|
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Ruby
|
||||
#
|
||||
# A dynamic, reflective, object-oriented, general-purpose programming language.
|
||||
# Link: https://www.ruby-lang.org/
|
||||
|
||||
function __sf_section_ruby -d "Show current version of Ruby"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_RUBY_SHOW true
|
||||
__sf_util_set_default SPACEFISH_RUBY_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_RUBY_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_RUBY_SYMBOL "💎 "
|
||||
__sf_util_set_default SPACEFISH_RUBY_COLOR red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Check if that user wants to show ruby version
|
||||
[ $SPACEFISH_RUBY_SHOW = false ]; and return
|
||||
|
||||
# Show versions only for Ruby-specific folders
|
||||
if not test -f Gemfile \
|
||||
-o -f Rakefile \
|
||||
-o (count *.rb) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
set -l ruby_version
|
||||
|
||||
if type -q rvm-prompt
|
||||
set ruby_version (rvm-prompt i v g)
|
||||
else if type -q rbenv
|
||||
set ruby_version (rbenv version-name)
|
||||
else if type -q chruby
|
||||
set ruby_version $RUBY_AUTO_VERSION
|
||||
else if type -q asdf
|
||||
set ruby_version (asdf current ruby | awk '{print $1}')
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
[ -z "$ruby_version" -o "$ruby_version" = "system" ]; and return
|
||||
|
||||
# Add 'v' before ruby version that starts with a number
|
||||
if test -n (echo (string match -r "^[0-9].+\$" "$ruby_version"))
|
||||
set ruby_version "v$ruby_version"
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_RUBY_COLOR \
|
||||
$SPACEFISH_RUBY_PREFIX \
|
||||
"$SPACEFISH_RUBY_SYMBOL""$ruby_version" \
|
||||
$SPACEFISH_RUBY_SUFFIX
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Rust
|
||||
#
|
||||
# Rust is a systems programming language sponsored by Mozilla Research.
|
||||
# Link: https://www.rust-lang.org
|
||||
|
||||
function __sf_section_rust -d "Display the current Rust version"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_RUST_SHOW true
|
||||
__sf_util_set_default SPACEFISH_RUST_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_RUST_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_RUST_SYMBOL "𝗥 "
|
||||
__sf_util_set_default SPACEFISH_RUST_COLOR red
|
||||
__sf_util_set_default SPACEFISH_RUST_VERBOSE_VERSION false
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show current version of Rust
|
||||
[ $SPACEFISH_RUST_SHOW = false ]; and return
|
||||
|
||||
# Ensure the rustc command is available
|
||||
type -q rustc; or return
|
||||
|
||||
if not test -f Cargo.toml \
|
||||
-o (count *.rs) -gt 0
|
||||
return
|
||||
end
|
||||
|
||||
set -l rust_version (rustc --version | string split ' ')[2]
|
||||
|
||||
if test $SPACEFISH_RUST_VERBOSE_VERSION = false
|
||||
set rust_version (string split '-' $rust_version)[1] # Cut off -suffixes from version. "v1.30.0-beta" vs "v1.30.0"
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_RUST_COLOR \
|
||||
$SPACEFISH_RUST_PREFIX \
|
||||
"$SPACEFISH_RUST_SYMBOL"v"$rust_version" \
|
||||
$SPACEFISH_RUST_SUFFIX
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
#
|
||||
# Time
|
||||
#
|
||||
|
||||
function __sf_section_time -d "Display the current time!"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_TIME_SHOW false
|
||||
__sf_util_set_default SPACEFISH_DATE_SHOW false
|
||||
__sf_util_set_default SPACEFISH_TIME_PREFIX "at "
|
||||
__sf_util_set_default SPACEFISH_TIME_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_TIME_FORMAT false
|
||||
__sf_util_set_default SPACEFISH_TIME_12HR false
|
||||
__sf_util_set_default SPACEFISH_TIME_COLOR "yellow"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_TIME_SHOW = false ]; and return
|
||||
|
||||
set -l time_str
|
||||
|
||||
if test $SPACEFISH_DATE_SHOW = true
|
||||
set time_str (date '+%Y-%m-%d')" "
|
||||
end
|
||||
|
||||
if not test $SPACEFISH_TIME_FORMAT = false
|
||||
set time_str "$time_str"(date '+'$SPACEFISH_TIME_FORMAT)
|
||||
else if test $SPACEFISH_TIME_12HR = true
|
||||
set time_str "$time_str"(date '+%I:%M:%S') # Fish doesn't seem to have date/time formatting.
|
||||
else
|
||||
set time_str "$time_str"(date '+%H:%M:%S')
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_TIME_COLOR \
|
||||
$SPACEFISH_TIME_PREFIX \
|
||||
$time_str \
|
||||
$SPACEFISH_TIME_SUFFIX
|
||||
end
|
@ -0,0 +1,49 @@
|
||||
#
|
||||
# Username
|
||||
#
|
||||
|
||||
function __sf_section_user -d "Display the username"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# | SPACEFISH_USER_SHOW | show username on local | show username on remote |
|
||||
# |---------------------+------------------------+-------------------------|
|
||||
# | false | never | never |
|
||||
# | always | always | always |
|
||||
# | true | if needed | always |
|
||||
# | needed | if needed | if needed |
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_USER_SHOW true
|
||||
__sf_util_set_default SPACEFISH_USER_PREFIX "with "
|
||||
__sf_util_set_default SPACEFISH_USER_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_USER_COLOR yellow
|
||||
__sf_util_set_default SPACEFISH_USER_COLOR_ROOT red
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_USER_SHOW = false ]; and return
|
||||
|
||||
if test "$SPACEFISH_USER_SHOW" = "always" \
|
||||
-o "$LOGNAME" != "$USER" \
|
||||
-o "$UID" = "0" \
|
||||
-o \( "$SPACEFISH_USER_SHOW" = "true" -a -n "$SSH_CONNECTION" \)
|
||||
|
||||
set -l user_color
|
||||
if test "$USER" = "root"
|
||||
set user_color $SPACEFISH_USER_COLOR_ROOT
|
||||
else
|
||||
set user_color $SPACEFISH_USER_COLOR
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$user_color \
|
||||
$SPACEFISH_USER_PREFIX \
|
||||
$USER \
|
||||
$SPACEFISH_USER_SUFFIX
|
||||
end
|
||||
end
|
@ -0,0 +1,36 @@
|
||||
# virtualenv
|
||||
#
|
||||
|
||||
function __sf_section_venv -d "Show current virtual Python environment"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_VENV_SHOW true
|
||||
__sf_util_set_default SPACEFISH_VENV_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
|
||||
__sf_util_set_default SPACEFISH_VENV_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_VENV_SYMBOL "·"
|
||||
__sf_util_set_default SPACEFISH_VENV_GENERIC_NAMES virtualenv venv .venv
|
||||
__sf_util_set_default SPACEFISH_VENV_COLOR blue
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Show venv python version
|
||||
test $SPACEFISH_VENV_SHOW = false; and return
|
||||
|
||||
# Check if the current directory running via Virtualenv
|
||||
test -n "$VIRTUAL_ENV"; or return
|
||||
|
||||
set -l venv (basename $VIRTUAL_ENV)
|
||||
if contains $venv $SPACEFISH_VENV_GENERIC_NAMES
|
||||
set venv (basename (dirname $VIRTUAL_ENV))
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_VENV_COLOR \
|
||||
$SPACEFISH_VENV_PREFIX \
|
||||
"$SPACEFISH_VENV_SYMBOL""$venv" \
|
||||
$SPACEFISH_VENV_SUFFIX
|
||||
end
|
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Vi Mode
|
||||
#
|
||||
|
||||
function __sf_section_vi_mode -d "Display vi mode status"
|
||||
# ------------------------------------------------------------------------------
|
||||
# Configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_SHOW true
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_PREFIX " "
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_INSERT [I]
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_NORMAL [N]
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_VISUAL [V]
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_REPLACE_ONE [R]
|
||||
__sf_util_set_default SPACEFISH_VI_MODE_COLOR white
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Section
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[ $SPACEFISH_VI_MODE_SHOW = false ]; and return
|
||||
|
||||
# Ensure fish_vi_key_bindings or fish_hybrid_key_bindings are used
|
||||
# Here we are trying to be compatible with default fish_mode_prompt implementation,
|
||||
# wich handle both "fish_vi_key_bindings" and "fish_hybrid_key_bindings"
|
||||
[ "$fish_key_bindings" = "fish_vi_key_bindings" ]; or [ "$fish_key_bindings" = "fish_hybrid_key_bindings" ]; or return
|
||||
|
||||
# Use `set -l` to define local variables to avoid populating
|
||||
# the global namespace
|
||||
set -l vi_mode_symbol
|
||||
|
||||
# Check current mode and set vi_mode_symbol based on it
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set vi_mode_symbol $SPACEFISH_VI_MODE_NORMAL
|
||||
case insert
|
||||
set vi_mode_symbol $SPACEFISH_VI_MODE_INSERT
|
||||
case replace_one
|
||||
set vi_mode_symbol $SPACEFISH_VI_MODE_REPLACE_ONE
|
||||
case visual
|
||||
set vi_mode_symbol $SPACEFISH_VI_MODE_VISUAL
|
||||
end
|
||||
|
||||
__sf_lib_section \
|
||||
$SPACEFISH_VI_MODE_COLOR \
|
||||
$SPACEFISH_VI_MODE_PREFIX \
|
||||
$vi_mode_symbol \
|
||||
$SPACEFISH_VI_MODE_SUFFIX
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Git branch
|
||||
#
|
||||
|
||||
function __sf_util_git_branch -d "Display the current branch name"
|
||||
echo (command git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Human time
|
||||
#
|
||||
|
||||
function __sf_util_human_time -d "Humanize a time interval for display"
|
||||
command awk '
|
||||
function hmTime(time, stamp) {
|
||||
split("h:m:s:ms", units, ":")
|
||||
for (i = 2; i >= -1; i--) {
|
||||
if (t = int( i < 0 ? time % 1000 : time / (60 ^ i * 1000) % 60 )) {
|
||||
stamp = stamp t units[sqrt((i - 2) ^ 2) + 1] " "
|
||||
}
|
||||
}
|
||||
if (stamp ~ /^ *$/) {
|
||||
return "0ms"
|
||||
}
|
||||
return substr(stamp, 1, length(stamp) - 1)
|
||||
}
|
||||
{
|
||||
print hmTime($0)
|
||||
}
|
||||
'
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Set default
|
||||
#
|
||||
|
||||
function __sf_util_set_default -a var -d "Set the default value for a global variable"
|
||||
if not set -q $var
|
||||
# Multiple arguments will become a list
|
||||
set -g $var $argv[2..-1]
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Truncate directory
|
||||
#
|
||||
|
||||
function __sf_util_truncate_dir -a path truncate_to -d "Truncate a directory path"
|
||||
if test "$truncate_to" -eq 0
|
||||
echo $path
|
||||
else
|
||||
set -l folders (string split / $path)
|
||||
|
||||
if test (count $folders) -le "$truncate_to"
|
||||
echo $path
|
||||
else
|
||||
echo (string join / $folders[(math 0 - $truncate_to)..-1])
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
After Width: | Height: | Size: 186 KiB |
BIN
.config/fisher/github.com/matchai/spacefish/images/preview.gif
Normal file
BIN
.config/fisher/github.com/matchai/spacefish/images/preview.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 MiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 75 KiB |
8027
.config/fisher/github.com/matchai/spacefish/package-lock.json
generated
Normal file
8027
.config/fisher/github.com/matchai/spacefish/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
53
.config/fisher/github.com/matchai/spacefish/package.json
Normal file
53
.config/fisher/github.com/matchai/spacefish/package.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "spacefish",
|
||||
"version": "0.0.0-semantic-release",
|
||||
"description": "A Fish Shell prompt for Astronauts",
|
||||
"repository": "git@github.com:matchai/spacefish.git",
|
||||
"author": "Matan Kushner <matchai@me.com>",
|
||||
"scripts": {
|
||||
"test": "fish tests/run.fish",
|
||||
"docs:prepare": "gitbook install",
|
||||
"docs:build": "npm run docs:prepare && gitbook build",
|
||||
"docs:serve": "npm run docs:prepare && gitbook serve .",
|
||||
"contributors:add": "all-contributors add",
|
||||
"contributors:generate": "all-contributors generate"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^3.0.2",
|
||||
"@semantic-release/exec": "^3.3.1",
|
||||
"@semantic-release/git": "^7.0.6",
|
||||
"all-contributors-cli": "^5.4.1",
|
||||
"gitbook-cli": "^2.3.2"
|
||||
},
|
||||
"release": {
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "./scripts/version.sh ${nextRelease.version}"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"CHANGELOG.md",
|
||||
"fish_prompt.fish"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/github",
|
||||
{
|
||||
"releasedLabels": [
|
||||
"Status: Released"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
8
.config/fisher/github.com/matchai/spacefish/scripts/version.sh
Executable file
8
.config/fisher/github.com/matchai/spacefish/scripts/version.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
new_version=$1
|
||||
filename=$(pwd)/fish_prompt.fish
|
||||
|
||||
sed -e "s/set -g SPACEFISH_VERSION .*/set -g SPACEFISH_VERSION $new_version/g" $filename > $filename.bak
|
||||
mv -- $filename.bak $filename
|
||||
|
@ -0,0 +1,117 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
test "Displays only the colored content when 2 arguments are passed"
|
||||
(
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
) = (__sf_lib_section red "test content")
|
||||
end
|
||||
|
||||
test "Displays the prefix, colored content and suffix when 4 arguments are passed"
|
||||
(
|
||||
set_color --bold
|
||||
echo -n "prefix"
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix"
|
||||
set_color normal
|
||||
) = (__sf_lib_section red prefix "test content" suffix)
|
||||
end
|
||||
|
||||
test "Displays the prefix if prefixes are enabled"
|
||||
(
|
||||
set SPACEFISH_PROMPT_PREFIXES_SHOW true
|
||||
|
||||
set_color --bold
|
||||
echo -n "prefix"
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix"
|
||||
set_color normal
|
||||
) = (__sf_lib_section red prefix "test content" suffix)
|
||||
end
|
||||
|
||||
test "Doesn't display the prefix if prefixes are disabled"
|
||||
(
|
||||
set SPACEFISH_PROMPT_PREFIXES_SHOW false
|
||||
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix"
|
||||
set_color normal
|
||||
) = (__sf_lib_section red prefix "test content" suffix)
|
||||
end
|
||||
|
||||
test "Displays the suffix if suffixes are enabled"
|
||||
(
|
||||
set SPACEFISH_PROMPT_SUFFIXES_SHOW true
|
||||
|
||||
set_color --bold
|
||||
echo -n "prefix"
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix"
|
||||
set_color normal
|
||||
) = (__sf_lib_section red prefix "test content" suffix)
|
||||
end
|
||||
|
||||
test "Doesn't display the suffix if suffixes are disabled"
|
||||
(
|
||||
set SPACEFISH_PROMPT_SUFFIXES_SHOW false
|
||||
|
||||
set_color --bold
|
||||
echo -n "prefix"
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content"
|
||||
set_color normal
|
||||
) = (__sf_lib_section red prefix "test content" suffix)
|
||||
end
|
||||
|
||||
test "Only prints the prefix for the second consecutive section"
|
||||
(
|
||||
set sf_prompt_opened false
|
||||
|
||||
set_color --bold red
|
||||
echo -n "test content 1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix 1"
|
||||
set_color normal
|
||||
|
||||
set_color --bold
|
||||
echo -n "prefix 2"
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "test content 2"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "suffix 2"
|
||||
set_color normal
|
||||
) = (
|
||||
__sf_lib_section red "prefix 1" "test content 1" "suffix 1"
|
||||
__sf_lib_section red "prefix 2" "test content 2" "suffix 2"
|
||||
)
|
||||
end
|
@ -0,0 +1,89 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock aws \* 0
|
||||
set -g AWS_PROFILE user1
|
||||
end
|
||||
|
||||
test "Prints section when AWS_PROFILE is set"
|
||||
(
|
||||
set_color --bold
|
||||
echo -n "using "
|
||||
set_color normal
|
||||
set_color --bold ff8700
|
||||
echo -n "☁️ user1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "Doesn't print the section when AWS_PROFILE isn't set"
|
||||
(
|
||||
set --erase AWS_PROFILE
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "Doesn't print the section when AWS_PROFILE is set to \"default\""
|
||||
(
|
||||
set AWS_PROFILE default
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_AWS_SYMBOL changes the displayed character"
|
||||
(
|
||||
set SPACEFISH_AWS_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "using "
|
||||
set_color normal
|
||||
set_color --bold ff8700
|
||||
echo -n "· user1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_AWS_PREFIX changes the character prefix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_AWS_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold ff8700
|
||||
echo -n "☁️ user1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_AWS_SUFFIX changes the character suffix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_AWS_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "using "
|
||||
set_color normal
|
||||
set_color --bold ff8700
|
||||
echo -n "☁️ user1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_aws)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_AWS_SHOW is set to \"false\""
|
||||
(
|
||||
set SPACEFISH_AWS_SHOW false
|
||||
) = (__sf_section_aws)
|
||||
end
|
@ -0,0 +1,88 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
test "Displays default char with status code 0"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "➜"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_char)
|
||||
end
|
||||
|
||||
test "Displays default char with status code 1"
|
||||
(
|
||||
set sf_exit_code 1
|
||||
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "➜"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_char)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_CHAR_SYMBOL changes the displayed character"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_CHAR_SYMBOL ·
|
||||
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_char)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_CHAR_PREFIX changes the character prefix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_CHAR_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "➜"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_char)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_CHAR_SYMBOL changes the character suffix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_CHAR_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n ""
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "➜"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_char)
|
||||
end
|
@ -0,0 +1,79 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
set -l LOCAL_CONDA_VERSION 4.5.11
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock conda -V 0 "echo \"conda 4.5.11\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
if test "$CONDA_DEFAULT_ENV"
|
||||
set -e CONDA_DEFAULT_ENV
|
||||
end
|
||||
end
|
||||
|
||||
test "Prints section when conda is installed and CONDA_DEFAULT_ENV is set"
|
||||
(
|
||||
set -g CONDA_DEFAULT_ENV some-env
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🅒 v$LOCAL_CONDA_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_conda)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_CONDA_SYMBOL changes the displayed character"
|
||||
(
|
||||
set SPACEFISH_CONDA_SYMBOL "· "
|
||||
set -g CONDA_DEFAULT_ENV some-env
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "· v$LOCAL_CONDA_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_conda)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_CONDA_PREFIX changes the character prefix"
|
||||
(
|
||||
set SPACEFISH_CONDA_PREFIX ·
|
||||
set -g CONDA_DEFAULT_ENV some-env
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🅒 v$LOCAL_CONDA_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_conda)
|
||||
end
|
||||
|
||||
|
||||
# Negative
|
||||
test "Doesn't display section when SPACEFISH_CONDA_SHOW is set to 'false'"
|
||||
(
|
||||
set -g SPACEFISH_CONDA_SHOW false
|
||||
set -g CONDA_DEFAULT_ENV some-env
|
||||
) = (__sf_section_conda)
|
||||
end
|
||||
|
||||
test "Doesn't display section when CONDA_DEFAULT_ENV is not set"
|
||||
() = (__sf_section_conda)
|
||||
end
|
@ -0,0 +1,383 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mkdir -p ~/.tmp-spacefish/dir1/dir2
|
||||
mkdir -p /tmp/tmp-spacefish/dir1/dir2/dir3
|
||||
mkdir -p /tmp/tmp-spacefish/writeProtected
|
||||
chmod 500 /tmp/tmp-spacefish/writeProtected
|
||||
# disabling SPACEFISH_DIR_LOCK_SYMBOL to avoid breaking old tests
|
||||
set SPACEFISH_DIR_LOCK_SHOW false
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf ~/.tmp-spacefish
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
#
|
||||
# Home directory
|
||||
#
|
||||
|
||||
test "Correctly truncates home directory"
|
||||
(
|
||||
cd ~
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a home subdirectory"
|
||||
(
|
||||
cd ~/.tmp-spacefish/dir1/
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~/.tmp-spacefish/dir1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a deeply nested home subdirectory"
|
||||
(
|
||||
cd ~/.tmp-spacefish/dir1/dir2
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n ".tmp-spacefish/dir1/dir2"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
#
|
||||
# Root directory
|
||||
#
|
||||
|
||||
test "Correctly truncates root directory"
|
||||
(
|
||||
cd /
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "/"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a root subdirectory"
|
||||
(
|
||||
cd /usr
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "/usr"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a deeply nested root subdirectory"
|
||||
(
|
||||
cd /tmp/tmp-spacefish/dir1/dir2
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp-spacefish/dir1/dir2"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
#
|
||||
# Git directory
|
||||
#
|
||||
|
||||
test "Correctly truncates the root of a git directory"
|
||||
(
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp-spacefish"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a git subdirectory"
|
||||
(
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
cd /tmp/tmp-spacefish/dir1
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp-spacefish/dir1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates a deeply nested git subdirectory"
|
||||
(
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
cd /tmp/tmp-spacefish/dir1/dir2/dir3
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "dir1/dir2/dir3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Correctly truncates the root of a git directory within another"
|
||||
(
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
|
||||
cd /tmp/tmp-spacefish/dir1
|
||||
command git init >/dev/null
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "dir1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Doesn't throw an error when in a .git directory"
|
||||
(
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
|
||||
cd /tmp/tmp-spacefish/.git
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp/tmp-spacefish/.git"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
|
||||
#
|
||||
# Configuration
|
||||
#
|
||||
|
||||
test "Doesn't show if SPACEFISH_DIR_SHOW is false"
|
||||
(
|
||||
set SPACEFISH_DIR_SHOW false
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DIR_PREFIX changes the dir prefix"
|
||||
(
|
||||
set SPACEFISH_DIR_PREFIX ·
|
||||
cd ~
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DIR_SUFFIX changes the dir prefix"
|
||||
(
|
||||
set SPACEFISH_DIR_SUFFIX ·
|
||||
cd ~
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
# SPACEFISH_DIR_TRUNC functionality is further tested in:
|
||||
# __sf_util_truncate_dir.test.fish
|
||||
test "Changing SPACEFISH_DIR_TRUNC changes the dir length"
|
||||
(
|
||||
set SPACEFISH_DIR_TRUNC 1
|
||||
cd /tmp/tmp-spacefish/dir1/dir2/dir3
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "dir3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Disabling SPACEFISH_DIR_TRUNC_REPO stops repo dir truncation"
|
||||
(
|
||||
set SPACEFISH_DIR_TRUNC_REPO false
|
||||
cd ~/.tmp-spacefish
|
||||
command git init >/dev/null
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~/.tmp-spacefish"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DIR_COLOR changes the dir color"
|
||||
(
|
||||
set SPACEFISH_DIR_COLOR red
|
||||
cd ~
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "~"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# SPACEFISH_DIR_LOCK_SYMBOL
|
||||
#
|
||||
|
||||
test "Shows DIR_LOCK_SYMBOL if in a dir with no write permissions and SPACEFISH_DIR_LOCK_SHOW is true"
|
||||
(
|
||||
cd /tmp/tmp-spacefish/writeProtected
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp/tmp-spacefish/writeProtected"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Doesn't show DIR_LOCK_SYMBOL if SPACEFISH_DIR_LOCK_SHOW is false"
|
||||
(
|
||||
cd /tmp/tmp-spacefish/writeProtected
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp/tmp-spacefish/writeProtected"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Doesn't show DIR_LOCK_SYMBOL if current directory is not write protected for this user"
|
||||
(
|
||||
cd ~
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "~"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DIR_LOCK_SYMBOL changes the symbol"
|
||||
(
|
||||
set SPACEFISH_DIR_LOCK_SYMBOL "😀"
|
||||
cd /tmp/tmp-spacefish/writeProtected
|
||||
|
||||
set_color --bold
|
||||
echo -n "in "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "tmp/tmp-spacefish/writeProtected"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dir)
|
||||
end
|
@ -0,0 +1,218 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
set -l LOCAL_DOCKER_VERSION 18.06.1
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock docker version 0 "echo \"18.06.1\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
if test "$COMPOSE_FILE"
|
||||
set -e COMPOSE_FILE
|
||||
end
|
||||
if test "$DOCKER_MACHINE_NAME"
|
||||
set -e DOCKER_MACHINE_NAME
|
||||
end
|
||||
end
|
||||
|
||||
test "Prints section when only Dockerfile is present"
|
||||
(
|
||||
touch Dockerfile
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints section when only docker-compose.yml is present"
|
||||
(
|
||||
touch docker-compose.yml
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints section when both Dockerfile and docker-compose.yml are present"
|
||||
(
|
||||
touch Dockerfile
|
||||
touch docker-compose.yml
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints Docker section when COMPOSE_FILE is set and the $COMPOSE_FILE exists"
|
||||
(
|
||||
set -g COMPOSE_FILE /tmp/some-compose-file.yml
|
||||
touch /tmp/some-compose-file.yml
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints section when only Dockerfile is present with DOCKER_MACHINE_NAME set"
|
||||
(
|
||||
rm /tmp/some-compose-file.yml
|
||||
touch Dockerfile
|
||||
set -g DOCKER_MACHINE_NAME some-machine-name
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints section when only docker-compose.yml is present with DOCKER_MACHINE_NAME set"
|
||||
(
|
||||
touch docker-compose.yml
|
||||
set -g DOCKER_MACHINE_NAME some-machine-name
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints section when both Dockerfile and docker-compose.yml are present with DOCKER_MACHINE_NAME set"
|
||||
(
|
||||
touch Dockerfile
|
||||
touch docker-compose.yml
|
||||
set -g DOCKER_MACHINE_NAME some-machine-name
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Prints Docker section when COMPOSE_FILE is set with DOCKER_MACHINE_NAME set"
|
||||
(
|
||||
set -g COMPOSE_FILE /tmp/some-compose-file.yml
|
||||
touch /tmp/some-compose-file.yml
|
||||
set -g DOCKER_MACHINE_NAME some-machine-name
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DOCKER_SYMBOL changes the displayed character"
|
||||
(
|
||||
rm /tmp/some-compose-file.yml
|
||||
set SPACEFISH_DOCKER_SYMBOL "· "
|
||||
touch Dockerfile
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "· v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DOCKER_PREFIX changes the character prefix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_DOCKER_PREFIX ·
|
||||
touch Dockerfile
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐳 v$LOCAL_DOCKER_VERSION"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
|
||||
# Negative
|
||||
test "Doesn't display section when SPACEFISH_DOCKER_SHOW is set to 'false'"
|
||||
(
|
||||
set SPACEFISH_DOCKER_SHOW false
|
||||
touch Dockerfile
|
||||
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Doesn't print section if docker is not installed"
|
||||
(
|
||||
touch Dockerfile
|
||||
mock docker version 127
|
||||
) = (__sf_section_docker)
|
||||
end
|
||||
|
||||
# This case can be checked only by bringing down the docker deamon
|
||||
test "Doesn't print section if docker deamon is not running"
|
||||
() = (__sf_section_docker)
|
||||
end
|
||||
|
||||
test "Doesn't print section when not in a directory with Dockerfile or docker-compose.yml"
|
||||
() = (__sf_section_docker)
|
||||
end
|
@ -0,0 +1,195 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock dotnet --version 0 "echo \"2.1.403\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints nothing when required files are missing"
|
||||
(
|
||||
rm -f /tmp/tmp-spacefish/project.json
|
||||
rm -f /tmp/tmp-spacefish/global.json
|
||||
rm -f /tmp/tmp-spacefish/paket.dependencies
|
||||
rm -f '/tmp/tmp-spacefish/*.sln'
|
||||
rm -f '/tmp/tmp-spacefish/*.csproj'
|
||||
rm -f '/tmp/tmp-spacefish/*.fsproj'
|
||||
rm -f '/tmp/tmp-spacefish/*.xproj'
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if project.json is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/project.json
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if global.json is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/global.json
|
||||
set_color --bold
|
||||
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if paket.dependencies is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/paket.dependencies
|
||||
set_color --bold
|
||||
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if a .csproj file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.csproj
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if a .fsproj file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.fsproj
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if a .xproj file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.xproj
|
||||
set_color --bold
|
||||
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Prints section if a .sln file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.sln
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DOTNET_SYMBOL changes the displayed character"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.sln
|
||||
|
||||
set SPACEFISH_DOTNET_SYMBOL "· "
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n "· 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DOTNET_PREFIX changes the character prefix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.sln
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_DOTNET_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_DOTNET_SUFFIX changes the character prefix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/tmp.sln
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_DOTNET_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold af00d7
|
||||
echo -n ".NET 2.1.403"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
||||
|
||||
test "Doesn't display .NET when SPACEFISH_DOTNET_SHOW is set to 'false'"
|
||||
(
|
||||
set SPACEFISH_DOTNET_SHOW false
|
||||
) = (__sf_section_dotnet)
|
||||
end
|
@ -0,0 +1,110 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock elixir -v 0 "echo \"Erlang/OTP 21 [erts-10.3.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
|
||||
Elixir 1.8.1 (compiled with Erlang/OTP 21)\""
|
||||
set -x ELIXIR_VERSION 1.8.1
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when mix.exs is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/mix.exs
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold magenta
|
||||
echo -n "💧 v1.8.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "Prints section when a *.ex file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/testfile.ex
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold magenta
|
||||
echo -n "💧 v1.8.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "Doesn't print the section when mix.exs and *.ex aren't present"
|
||||
() = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_ELIXIR_SYMBOL changes the displayed character"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/mix.exs
|
||||
set SPACEFISH_ELIXIR_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold magenta
|
||||
echo -n "· v1.8.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_ELIXIR_PREFIX changes the character prefix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/mix.exs
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_ELIXIR_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold magenta
|
||||
echo -n "💧 v1.8.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_ELIXIR_SUFFIX changes the character suffix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/mix.exs
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_ELIXIR_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold magenta
|
||||
echo -n "💧 v1.8.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_elixir)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_ELIXIR_SHOW is set to \"false\""
|
||||
(
|
||||
touch /tmp/tmp-spacefish/mix.exs
|
||||
set SPACEFISH_ELIXIR_SHOW false
|
||||
) = (__sf_section_elixir)
|
||||
end
|
@ -0,0 +1,51 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
test "Exit code not enabled by default"
|
||||
(
|
||||
set sf_exit_code 1
|
||||
) = (__sf_section_exit_code)
|
||||
end
|
||||
|
||||
test "Enable exit-code, shows exit code upon fail"
|
||||
(
|
||||
set SPACEFISH_EXIT_CODE_SHOW true
|
||||
set sf_exit_code 1
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "✘1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_exit_code)
|
||||
end
|
||||
|
||||
test "Hides exit code upon success"
|
||||
(
|
||||
set SPACEFISH_EXIT_CODE_SHOW true
|
||||
set sf_exit_code 0
|
||||
) = (__sf_section_exit_code)
|
||||
end
|
||||
|
||||
test "Color-changing exit code"
|
||||
(
|
||||
set SPACEFISH_EXIT_CODE_SHOW true
|
||||
set SPACEFISH_EXIT_CODE_COLOR "purple"
|
||||
set sf_exit_code 1
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold purple
|
||||
echo -n "✘1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_exit_code)
|
||||
end
|
@ -0,0 +1,129 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
command git init >/dev/null
|
||||
command git config --local user.email "test@example.com"
|
||||
command git config --local user.name "Test User"
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Displays no status symbols in a clean repo"
|
||||
() = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for untracked file"
|
||||
(
|
||||
touch testfile
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [?]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for added file"
|
||||
(
|
||||
touch testfile
|
||||
command git add testfile
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [+]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for modified file"
|
||||
(
|
||||
touch testfile
|
||||
command git add testfile
|
||||
command git commit -m "Initial commit" --quiet
|
||||
echo "modification" > testfile
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [!]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for renamed file"
|
||||
(
|
||||
touch testfile
|
||||
command git add testfile
|
||||
command git commit -m "Initial commit" --quiet
|
||||
mv testfile newtestfile
|
||||
command git add testfile newtestfile
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [»]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for deleted file"
|
||||
(
|
||||
touch testfile
|
||||
command git add testfile
|
||||
command git commit -m "Initial commit" --quiet
|
||||
rm testfile
|
||||
command git add testfile
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [✘]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Displays the correct symbol for stashed file"
|
||||
(
|
||||
touch testfile
|
||||
command git add testfile
|
||||
command git commit -m "Initial commit" --quiet
|
||||
echo "modification" > testfile
|
||||
command git stash --quiet
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n " [\$]"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
set_color normal
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
test "Test config option SPACEFISH_GIT_STATUS_SHOW"
|
||||
(
|
||||
set -g SPACEFISH_GIT_STATUS_SHOW false
|
||||
) = (__sf_section_git_status)
|
||||
end
|
||||
|
||||
# TODO: Get test dir into status *U*
|
||||
# TODO: Add test for ahead
|
||||
# TODO: Add test for behind
|
||||
# TODO: Add test for diverged
|
@ -0,0 +1,173 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock go version 0 "echo \"go version go1.10.3 darwin/amd64\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when Godeps is present"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/Godeps
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Prints section when glide.yaml is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/glide.yaml
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Prints section when Gopkg.yml is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.yml
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Prints section when Gopkg.lock is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Prints section when go.mod is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/go.mod
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Print section when using development version of golang"
|
||||
(
|
||||
mock go version 0 "echo go version devel +5efe9a8f11 Wed Jan 9 07:21:16 2019 +0000 darwin/amd64"
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 devel:5efe9a8f11"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Doesn't print the section when golang files aren't present"
|
||||
() = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_GOLANG_SYMBOL changes the displayed character"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
set SPACEFISH_GOLANG_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "· v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_GOLANG_PREFIX changes the character prefix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_GOLANG_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_GOLANG_SUFFIX changes the character suffix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_GOLANG_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "🐹 v1.10.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_golang)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_GOLANG_SHOW is set to \"false\""
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Gopkg.lock
|
||||
set SPACEFISH_GOLANG_SHOW false
|
||||
) = (__sf_section_golang)
|
||||
end
|
@ -0,0 +1,124 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
function teardown
|
||||
if set -q SSH_CONNECTION;
|
||||
set --erase SSH_CONNECTION
|
||||
end
|
||||
end
|
||||
|
||||
test "Correctly shows hostname upon SSH connection"
|
||||
(
|
||||
set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n (hostname)
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "Displays user when SPACEFISH_HOST_SHOW is set to \"always\""
|
||||
(
|
||||
set SPACEFISH_HOST_SHOW always
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n (hostname)
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "Displays user when SPACEFISH_HOST_SHOW is set to \"always\", over SSH"
|
||||
(
|
||||
set SPACEFISH_HOST_SHOW always
|
||||
set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n (hostname)
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_HOST_SHOW is set to \"false\""
|
||||
(
|
||||
set SPACEFISH_HOST_SHOW false
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "Displays hostname when set different from machine name, over SSH"
|
||||
(
|
||||
mock hostname \* 0 "echo \"spacefish\""
|
||||
set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "spacefish"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "Doesn't display hostname by default, without SSH"
|
||||
() = (__sf_section_host)
|
||||
end
|
||||
|
||||
# Color testing; magenta = pass, red = failure.
|
||||
test "Test color, no SSH."
|
||||
(
|
||||
set SPACEFISH_HOST_COLOR "magenta" # No SSH connection. This should display.
|
||||
set SPACEFISH_HOST_COLOR_SSH "red" # If red shows, test failed.
|
||||
set SPACEFISH_HOST_SHOW always
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold "magenta"
|
||||
echo -n (hostname)
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
||||
|
||||
test "Test color, with SSH."
|
||||
(
|
||||
set SPACEFISH_HOST_COLOR "red" # If red shows, test failed.
|
||||
set SPACEFISH_HOST_COLOR_SSH "magenta" # SSH connection exists. This should take precedence.
|
||||
set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold "magenta"
|
||||
echo -n (hostname)
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_host)
|
||||
end
|
@ -0,0 +1,120 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
function teardown
|
||||
killall sleep # Kill any previous background jobs
|
||||
end
|
||||
|
||||
test "Test a single background job"
|
||||
(
|
||||
sleep 5 & # Background process
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
||||
|
||||
test "Test with two background jobs"
|
||||
(
|
||||
sleep 5 & # Background process #1
|
||||
sleep 5 & # Background process #2
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦2"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
||||
|
||||
test "Test with five background jobs"
|
||||
(
|
||||
sleep 5 & # Background process #1
|
||||
sleep 5 & # Background process #2
|
||||
sleep 5 & # Background process #3
|
||||
sleep 5 & # Background process #4
|
||||
sleep 5 & # Background process #5
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦5"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
||||
|
||||
test "Test with less than threshold of background jobs"
|
||||
(
|
||||
set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
|
||||
|
||||
sleep 5 & # Background process #1
|
||||
sleep 5 & # Background process #2
|
||||
sleep 5 & # Background process #3
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
||||
|
||||
test "Test with equal threshold of background jobs"
|
||||
(
|
||||
set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
|
||||
|
||||
sleep 5 & # Background process #1
|
||||
sleep 5 & # Background process #2
|
||||
sleep 5 & # Background process #3
|
||||
sleep 5 & # Background process #4
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
||||
|
||||
test "Test with more than threshold of background jobs"
|
||||
(
|
||||
set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
|
||||
|
||||
sleep 5 & # Background process #1
|
||||
sleep 5 & # Background process #2
|
||||
sleep 5 & # Background process #3
|
||||
sleep 5 & # Background process #4
|
||||
sleep 5 & # Background process #5
|
||||
sleep 5 & # Background process #6
|
||||
|
||||
set_color --bold
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "✦6"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_jobs)
|
||||
end
|
@ -0,0 +1,93 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock julia --version 0 "echo \"julia version 1.0.1\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when julia is installed and pwd has *.jl file(s)"
|
||||
(
|
||||
touch some-julia-file.jl
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "ஃ v1.0.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_julia)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_JULIA_SYMBOL changes the displayed character"
|
||||
(
|
||||
set SPACEFISH_JULIA_SYMBOL "· "
|
||||
touch some-julia-file.jl
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "· v1.0.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_julia)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_JULIA_PREFIX changes the character prefix"
|
||||
(
|
||||
set SPACEFISH_JULIA_PREFIX ·
|
||||
touch some-julia-file.jl
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "ஃ v1.0.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_julia)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_JULIA_SUFFIX changes the character suffix"
|
||||
(
|
||||
set SPACEFISH_JULIA_SUFFIX ·
|
||||
touch some-julia-file.jl
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "ஃ v1.0.1"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_julia)
|
||||
end
|
||||
|
||||
|
||||
# Negative
|
||||
test "Doesn't display section when SPACEFISH_JULIA_SHOW is set to 'false'"
|
||||
(
|
||||
set -g SPACEFISH_JULIA_SHOW false
|
||||
touch some-julia-file.jl
|
||||
|
||||
) = (__sf_section_julia)
|
||||
end
|
||||
|
||||
test "Doesn't display section when pwd has no *.jl file"
|
||||
() = (__sf_section_julia)
|
||||
end
|
@ -0,0 +1,119 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock kubectl config 0 "echo \"testkube\""
|
||||
end
|
||||
|
||||
test "Prints section"
|
||||
(
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "☸️ testkube (testkube)"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Kubecontext symbol does not appear outside of a Kubernetes project"
|
||||
(
|
||||
mock kubectl config 1
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_KUBECONTEXT_SYMBOL changes the displayed character"
|
||||
(
|
||||
set SPACEFISH_KUBECONTEXT_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "· testkube (testkube)"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_KUBECONTEXT_PREFIX changes the character prefix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_KUBECONTEXT_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "☸️ testkube (testkube)"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_KUBECONTEXT_SUFFIX changes the character suffix"
|
||||
(
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_KUBECONTEXT_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "☸️ testkube (testkube)"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Doesn't display the section when SPACEFISH_KUBECONTEXT_SHOW is set to \"false\""
|
||||
(
|
||||
set SPACEFISH_KUBECONTEXT_SHOW false
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Doesn't display the namespace section when SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW is set to \"false\""
|
||||
(
|
||||
set SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW false
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_KUBECONTEXT_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "☸️ testkube"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
||||
|
||||
test "Doesn't display the namespace section when kube_context is set to \"default\""
|
||||
(
|
||||
mock kubectl config 0 "echo \"default\""
|
||||
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_KUBECONTEXT_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "at "
|
||||
set_color normal
|
||||
set_color --bold cyan
|
||||
echo -n "☸️ default"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_kubecontext)
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
end
|
||||
|
||||
test "Echoes a line break"
|
||||
(
|
||||
echo -n -e \n
|
||||
) = (__sf_section_line_sep)
|
||||
end
|
||||
|
||||
test "Disabling SPACEFISH_PROMPT_SEPARATE_LINE doesn't display a line break"
|
||||
(
|
||||
set SPACEFISH_PROMPT_SEPARATE_LINE false
|
||||
) = (__sf_section_line_sep)
|
||||
end
|
@ -0,0 +1,192 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock node -v 0 "echo \"v9.8.0\""
|
||||
mkdir -p /tmp/tmp-spacefish/
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when node_modules is present"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints section when package.json is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/package.json
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Doesn't print section when not in a directory with node_modules or package.json"
|
||||
() = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints nvm version when nvm is installed"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set -e sf_node_version
|
||||
mock nvm current 0 "echo \"v9.8.0\""
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints cached nvm version if previously used"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set sf_node_version "v1.2.3"
|
||||
set sf_last_nvm_bin "path_to_bin"
|
||||
set NVM_BIN "path_to_bin"
|
||||
mock nvm current 0
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v1.2.3"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints nodenv version when nodenv is installed"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
mock nodenv version-name 0 "echo \"v9.8.0\""
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
|
||||
test "Prints nothing when using the \"system\" version of node with nvm"
|
||||
(
|
||||
mkdir -p /tmp/tmp-spacefish/node_modules
|
||||
mock nvm current 0 "echo \"system\""
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints nothing when using the \"system\" version of node with nodenv"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
mock nodenv version-name 0 "echo \"system\""
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Prints nodenv version when nodenv is installed"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
mock nodenv version-name 0 "echo \"node\""
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_NODE_SYMBOL changes the displayed character"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
mock nvm current 0 "echo \"v9.8.0\""
|
||||
set SPACEFISH_NODE_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "· v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_NODE_PREFIX changes the character prefix"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_NODE_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_NODE_PREFIX changes the character prefix"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_NODE_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold green
|
||||
echo -n "⬢ v9.8.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "Setting SPACEFISH_NODE_DEFAULT_VERSION to the current version disables the section"
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_NODE_DEFAULT_VERSION v9.8.0
|
||||
) = (__sf_section_node)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_NODE_SHOW is set to \"false\""
|
||||
(
|
||||
mkdir /tmp/tmp-spacefish/node_modules
|
||||
set SPACEFISH_NODE_SHOW false
|
||||
) = (__sf_section_node)
|
||||
end
|
@ -0,0 +1,72 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock cargo pkgid 0 "echo \"file:///Users/sirMerr/Development/test-rust#0.1.0\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when Cargo.toml is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Cargo.toml
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "📦 v0.1.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_package)
|
||||
end
|
||||
|
||||
test "Prints section when package.json is present"
|
||||
(
|
||||
echo "{\"version\": \"1.0\"}" > /tmp/tmp-spacefish/package.json
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "📦 v1.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_package)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_PACKAGE_SUFFIX changes the character suffix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Cargo.toml
|
||||
set SPACEFISH_PACKAGE_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "is "
|
||||
set_color normal
|
||||
set_color --bold red
|
||||
echo -n "📦 v0.1.0"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_package)
|
||||
end
|
||||
|
||||
test "Does not print section when Cargo.toml or package.json is not present"
|
||||
() = (__sf_section_package)
|
||||
end
|
||||
|
||||
test "Doesn't display the section when SPACEFISH_PACKAGE_SHOW is set to \"false\""
|
||||
(
|
||||
touch /tmp/tmp-spacefish/Cargo.toml
|
||||
set SPACEFISH_PACKAGE_SHOW false
|
||||
) = (__sf_section_package)
|
||||
end
|
@ -0,0 +1,110 @@
|
||||
source $DIRNAME/spacefish_test_setup.fish
|
||||
|
||||
function setup
|
||||
spacefish_test_setup
|
||||
mock php -v 0 "echo \"PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
|
||||
Copyright (c) 1997-2018 The PHP Group
|
||||
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies\""
|
||||
mkdir -p /tmp/tmp-spacefish
|
||||
cd /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
function teardown
|
||||
rm -rf /tmp/tmp-spacefish
|
||||
end
|
||||
|
||||
test "Prints section when composer.json is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/composer.json
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🐘 v7.1.16"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "Prints section when a *.php file is present"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/testfile.php
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🐘 v7.1.16"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "Doesn't print the section when composer.json and *.php aren't present"
|
||||
() = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_PHP_SYMBOL changes the displayed character"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/composer.json
|
||||
set SPACEFISH_PHP_SYMBOL "· "
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "· v7.1.16"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_PHP_PREFIX changes the character prefix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/composer.json
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_PHP_PREFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🐘 v7.1.16"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n " "
|
||||
set_color normal
|
||||
) = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "Changing SPACEFISH_PHP_SUFFIX changes the character suffix"
|
||||
(
|
||||
touch /tmp/tmp-spacefish/composer.json
|
||||
set sf_exit_code 0
|
||||
set SPACEFISH_PHP_SUFFIX ·
|
||||
|
||||
set_color --bold
|
||||
echo -n "via "
|
||||
set_color normal
|
||||
set_color --bold blue
|
||||
echo -n "🐘 v7.1.16"
|
||||
set_color normal
|
||||
set_color --bold
|
||||
echo -n "·"
|
||||
set_color normal
|
||||
) = (__sf_section_php)
|
||||
end
|
||||
|
||||
test "doesn't display the section when SPACEFISH_PHP_SHOW is set to \"false\""
|
||||
(
|
||||
touch /tmp/tmp-spacefish/composer.json
|
||||
set SPACEFISH_PHP_SHOW false
|
||||
) = (__sf_section_php)
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user