mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 12:03:48 +03:00
Fix wizard
This commit is contained in:
parent
3d225378b9
commit
c72a2b8447
@ -1,28 +0,0 @@
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
if test (math $CMD_DURATION/1000) -gt $lean_timer_duration
|
||||
for i in (seq (math $COLUMNS-(string length (echo -n " "(math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"))-1))
|
||||
set_color $lean_prompt_connection_color
|
||||
echo -n $lean_prompt_connection
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
set_color $lean_timer_color
|
||||
echo -n " "(math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"
|
||||
set_color $fish_color_normal
|
||||
else
|
||||
for i in (seq (math $COLUMNS-1))
|
||||
set_color $lean_prompt_connection_color
|
||||
echo -n $lean_prompt_connection
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
end
|
||||
echo -e "\r"(lean_pwd)(lean_git_prompt)" "
|
||||
# Prompt character
|
||||
if test $last_status -eq 0
|
||||
set_color $lean_green
|
||||
else
|
||||
set_color $fish_color_error
|
||||
end
|
||||
echo -n "❯ "
|
||||
set_color $fish_color_normal
|
||||
end
|
@ -7,6 +7,8 @@ function lean_uninstall
|
||||
rm "$__fish_config_dir/functions/lean*"
|
||||
|
||||
# ---------------Erase Theme Variables---------------
|
||||
# --------------Prompt--------------
|
||||
set -l vars $vars lean_prompt_connection lean_prompt_connection_color
|
||||
# --------------Colors--------------
|
||||
set -l vars $vars lean_color_green lean_color_light_blue lean_color_dark_blue lean_color_gold
|
||||
# --------------Timer--------------
|
||||
|
@ -4,11 +4,8 @@ function lean_wizard
|
||||
return 1
|
||||
end
|
||||
|
||||
set -g leanTimerDurationSave $lean_timer_duration
|
||||
set -U lean_timer_duration 0
|
||||
set -g tempPrompt "$__fish_config_dir/lean_theme/temp_prompt.fish"
|
||||
set -g moduleDir "$__fish_config_dir/lean_theme/prompt_modules"
|
||||
set -g fishPrompt "$__fish_config_dir/functions/fish_prompt.fish"
|
||||
set -g tempPrompt "$__fish_config_dir/lean_theme/temp_prompt.fish"
|
||||
set -g columns $COLUMNS
|
||||
set -g lines $LINES
|
||||
|
||||
@ -23,8 +20,8 @@ end
|
||||
|
||||
function _setDefaults
|
||||
set -g newline true
|
||||
set -g lean_prompt_connection " "
|
||||
set -g lean_prompt_connection_color 6C6C6C
|
||||
set -g fake_lean_prompt_connection " "
|
||||
set -g fake_lean_prompt_connection_color 6C6C6C
|
||||
end
|
||||
|
||||
function _promptHeight
|
||||
@ -57,28 +54,25 @@ function _promptConnection
|
||||
_title "Prompt Connection"
|
||||
|
||||
echo "(1) Disconnected"
|
||||
_displayPrompt lean_prompt_connection " "
|
||||
_displayPrompt fake_lean_prompt_connection " "
|
||||
|
||||
echo "(2) Dotted"
|
||||
_displayPrompt lean_prompt_connection "·"
|
||||
_displayPrompt fake_lean_prompt_connection "·"
|
||||
|
||||
echo "(3) Solid"
|
||||
_displayPrompt lean_prompt_connection "─"
|
||||
_displayPrompt fake_lean_prompt_connection "─"
|
||||
|
||||
_displayRestartAndQuit
|
||||
|
||||
switch (lean_user_ask "Choice" 1/2/3/r/q)
|
||||
case 1
|
||||
set -U lean_prompt_connection " "
|
||||
set -g lean_prompt_connection " "
|
||||
set -g fake_lean_prompt_connection " "
|
||||
_promptSpacing
|
||||
case 2
|
||||
set -U lean_prompt_connection "·"
|
||||
set -g lean_prompt_connection "·"
|
||||
set -g fake_lean_prompt_connection "·"
|
||||
_promptConnectionColor
|
||||
case 3
|
||||
set -U lean_prompt_connection "─"
|
||||
set -g lean_prompt_connection "─"
|
||||
set -g fake_lean_prompt_connection "─"
|
||||
_promptConnectionColor
|
||||
case r
|
||||
_begin
|
||||
@ -92,35 +86,31 @@ function _promptConnectionColor
|
||||
_title "Connection Color"
|
||||
|
||||
echo "(1) Lightest"
|
||||
_displayPrompt lean_prompt_connection_color 808080
|
||||
_displayPrompt fake_lean_prompt_connection_color 808080
|
||||
|
||||
echo "(2) Light"
|
||||
_displayPrompt lean_prompt_connection_color 6C6C6C
|
||||
_displayPrompt fake_lean_prompt_connection_color 6C6C6C
|
||||
|
||||
echo "(3) Dark"
|
||||
_displayPrompt lean_prompt_connection_color 585858
|
||||
_displayPrompt fake_lean_prompt_connection_color 585858
|
||||
|
||||
echo "(4) Darkest"
|
||||
_displayPrompt lean_prompt_connection_color 444444
|
||||
_displayPrompt fake_lean_prompt_connection_color 444444
|
||||
|
||||
_displayRestartAndQuit
|
||||
|
||||
switch (lean_user_ask "Choice" 1/2/3/4/r/q)
|
||||
case 1
|
||||
set -U lean_prompt_connection_color 808080
|
||||
set -g lean_prompt_connection_color 808080
|
||||
set -g fake_lean_prompt_connection_color 808080
|
||||
_promptSpacing
|
||||
case 2
|
||||
set -U lean_prompt_connection_color 6C6C6C
|
||||
set -g lean_prompt_connection_color 6C6C6C
|
||||
set -g fake_lean_prompt_connection_color 6C6C6C
|
||||
_promptSpacing
|
||||
case 3
|
||||
set -U lean_prompt_connection_color 585858
|
||||
set -g lean_prompt_connection_color 585858
|
||||
set -g fake_lean_prompt_connection_color 585858
|
||||
_promptSpacing
|
||||
case 4
|
||||
set -U lean_prompt_connection_color 444444
|
||||
set -g lean_prompt_connection_color 444444
|
||||
set -g fake_lean_prompt_connection_color 444444
|
||||
_promptSpacing
|
||||
case r
|
||||
_begin
|
||||
@ -157,8 +147,16 @@ function _promptSpacing
|
||||
end
|
||||
end
|
||||
|
||||
function _assemble_prompt
|
||||
echo -n >$tempPrompt
|
||||
function _assemblePrompt --argument-names which
|
||||
set -g moduleDir "$__fish_config_dir/lean_theme/prompt_modules/$which""_prompt"
|
||||
|
||||
if test $which = "fish"
|
||||
set -g promptDir "$__fish_config_dir/functions/fish_prompt.fish"
|
||||
else
|
||||
set -g promptDir "$__fish_config_dir/lean_theme/temp_prompt.fish"
|
||||
end
|
||||
|
||||
echo -n >$promptDir
|
||||
|
||||
_addMod 1_initial
|
||||
if test $newline = "true"
|
||||
@ -169,7 +167,8 @@ function _assemble_prompt
|
||||
end
|
||||
|
||||
function _addMod --argument-names file
|
||||
cat "$moduleDir/$file" >>$tempPrompt
|
||||
cat "$moduleDir/$file" >>$promptDir
|
||||
printf "\n\n" >>$promptDir
|
||||
end
|
||||
|
||||
function _title --argument-names title
|
||||
@ -184,9 +183,9 @@ end
|
||||
|
||||
function _displayPrompt --argument-names var_name var_value
|
||||
set -g $var_name $var_value
|
||||
_assemble_prompt
|
||||
source $tempPrompt
|
||||
fish_prompt
|
||||
_assemblePrompt fake
|
||||
source $promptDir
|
||||
fake_prompt
|
||||
echo
|
||||
echo
|
||||
end
|
||||
@ -197,16 +196,13 @@ function _displayRestartAndQuit
|
||||
end
|
||||
|
||||
function _quit
|
||||
set -U lean_timer_duration $leanTimerDurationSave
|
||||
source $fishPrompt
|
||||
fish_prompt
|
||||
clear
|
||||
end
|
||||
|
||||
function _finish
|
||||
set -U lean_timer_duration $leanTimerDurationSave
|
||||
_assemble_prompt
|
||||
cat $tempPrompt >$fishPrompt
|
||||
source $fishPrompt
|
||||
clear
|
||||
_assemblePrompt fish
|
||||
set -U lean_prompt_connection $fake_lean_prompt_connection
|
||||
set -U lean_prompt_connection_color $fake_lean_prompt_connection_color
|
||||
_quit
|
||||
end
|
@ -1 +0,0 @@
|
||||
echo
|
@ -1 +0,0 @@
|
||||
echo -n (lean_pwd)(lean_git_prompt)" "
|
@ -1,17 +0,0 @@
|
||||
if test (math $CMD_DURATION/1000) -gt $lean_timer_duration
|
||||
for i in (seq (math $COLUMNS-(string length (echo -n " "(math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"))-1))
|
||||
set_color $lean_prompt_connection_color
|
||||
echo -n $lean_prompt_connection
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
set_color $lean_timer_color
|
||||
echo -n " "(math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"
|
||||
set_color $fish_color_normal
|
||||
else
|
||||
for i in (seq (math $COLUMNS-1))
|
||||
set_color $lean_prompt_connection_color
|
||||
echo -n $lean_prompt_connection
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
end
|
||||
echo -e "\r"(lean_pwd)(lean_git_prompt)" "
|
2
lean_theme/prompt_modules/fake_prompt/1_initial
Normal file
2
lean_theme/prompt_modules/fake_prompt/1_initial
Normal file
@ -0,0 +1,2 @@
|
||||
function fake_prompt --description 'Write out the prompt'
|
||||
set -l lastExitCode $status
|
1
lean_theme/prompt_modules/fake_prompt/2_newline
Normal file
1
lean_theme/prompt_modules/fake_prompt/2_newline
Normal file
@ -0,0 +1 @@
|
||||
echo
|
1
lean_theme/prompt_modules/fake_prompt/3_1Line
Normal file
1
lean_theme/prompt_modules/fake_prompt/3_1Line
Normal file
@ -0,0 +1 @@
|
||||
echo -n (lean_pwd)(lean_git_prompt)" "
|
11
lean_theme/prompt_modules/fake_prompt/3_2Line
Normal file
11
lean_theme/prompt_modules/fake_prompt/3_2Line
Normal file
@ -0,0 +1,11 @@
|
||||
set_color $fake_lean_prompt_connection_color
|
||||
printf "%.s$fake_lean_prompt_connection" (seq (math $COLUMNS-1))
|
||||
set_color $fish_color_normal
|
||||
|
||||
set -l timerOutput " 5s "
|
||||
set -l timerStartLocation (math $COLUMNS-(string length $timerOutput))
|
||||
printf "\r\033["$timerStartLocation"C"
|
||||
set_color $lean_timer_color
|
||||
echo -n $timerOutput
|
||||
set_color $fish_color_normal
|
||||
echo -e "\r"(lean_pwd)(lean_git_prompt)" "
|
@ -1,5 +1,5 @@
|
||||
# Prompt character
|
||||
if test $last_status -eq 0
|
||||
if test $lastExitCode -eq 0
|
||||
set_color $lean_color_green
|
||||
else
|
||||
set_color $fish_color_error
|
@ -1,2 +1,2 @@
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
set -l lastExitCode $status
|
1
lean_theme/prompt_modules/fish_prompt/2_newline
Normal file
1
lean_theme/prompt_modules/fish_prompt/2_newline
Normal file
@ -0,0 +1 @@
|
||||
echo
|
1
lean_theme/prompt_modules/fish_prompt/3_1Line
Normal file
1
lean_theme/prompt_modules/fish_prompt/3_1Line
Normal file
@ -0,0 +1 @@
|
||||
echo -n (lean_pwd)(lean_git_prompt)" "
|
13
lean_theme/prompt_modules/fish_prompt/3_2Line
Normal file
13
lean_theme/prompt_modules/fish_prompt/3_2Line
Normal file
@ -0,0 +1,13 @@
|
||||
set_color $lean_prompt_connection_color
|
||||
printf "%.s$lean_prompt_connection" (seq (math $COLUMNS-1))
|
||||
set_color $fish_color_normal
|
||||
if test (math $CMD_DURATION/1000) -gt $lean_timer_duration
|
||||
set -l timerOutput " "(math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s "
|
||||
set -l timerStartLocation (math $COLUMNS-(string length $timerOutput))
|
||||
|
||||
printf "\r\033["$timerStartLocation"C"
|
||||
set_color $lean_timer_color
|
||||
echo -n $timerOutput
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
echo -e "\r"(lean_pwd)(lean_git_prompt)" "
|
9
lean_theme/prompt_modules/fish_prompt/4_final
Normal file
9
lean_theme/prompt_modules/fish_prompt/4_final
Normal file
@ -0,0 +1,9 @@
|
||||
# Prompt character
|
||||
if test $lastExitCode -eq 0
|
||||
set_color $lean_color_green
|
||||
else
|
||||
set_color $fish_color_error
|
||||
end
|
||||
echo -n "❯ "
|
||||
set_color $fish_color_normal
|
||||
end
|
Loading…
Reference in New Issue
Block a user