mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 20:13:05 +03:00
Set variables in background job
This commit is contained in:
parent
85712feeaa
commit
f6262a2e28
@ -1,8 +1,8 @@
|
||||
function _tide_item_cmd_duration
|
||||
if test $_tide_cmd_duration -gt $tide_cmd_duration_threshold
|
||||
set -l seconds (math --scale=$tide_cmd_duration_decimals "$_tide_cmd_duration/1000" % 60)
|
||||
set -l minutes (math --scale=0 "$_tide_cmd_duration/60000" % 60)
|
||||
set -l hours (math --scale=0 "$_tide_cmd_duration/3600000")
|
||||
if test $CMD_DURATION -gt $tide_cmd_duration_threshold
|
||||
set -l seconds (math --scale=$tide_cmd_duration_decimals "$CMD_DURATION/1000" % 60)
|
||||
set -l minutes (math --scale=0 "$CMD_DURATION/60000" % 60)
|
||||
set -l hours (math --scale=0 "$CMD_DURATION/3600000")
|
||||
|
||||
set_color $tide_cmd_duration_color
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
function fish_prompt
|
||||
set -lx _tide_last_pipestatus $pipestatus
|
||||
set -lx _tide_last_status $status
|
||||
set -lx _tide_fish_pid $fish_pid # Used for right prompt
|
||||
fish --command "
|
||||
set -g _tide_last_pipestatus $pipestatus
|
||||
set -g _tide_last_status $status
|
||||
set -g _tide_fish_pid $fish_pid
|
||||
|
||||
test -n \"$SSH_TTY\" && set -g SSH_TTY
|
||||
set COLUMNS $COLUMNS
|
||||
set CMD_DURATION $CMD_DURATION
|
||||
|
||||
set -lx COLUMNS $COLUMNS
|
||||
set -q SSH_TTY && set -lx SSH_TTY $SSH_TTY
|
||||
set -lx _tide_cmd_duration $CMD_DURATION
|
||||
command kill $_tide_last_pid 2>/dev/null
|
||||
set -U _tide_left_prompt_display_$fish_pid (_tide_prompt)" &
|
||||
|
||||
fish --command "command kill $_tide_last_pid 2>/dev/null; set -U _tide_left_prompt_display_$fish_pid (_tide_prompt)" &
|
||||
set -g _tide_last_pid (jobs --last --pid)
|
||||
disown
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
@mesg '---------cmd_duration---------'
|
||||
|
||||
function _cmd_duration -a duration threshold decimals
|
||||
set -lx _tide_cmd_duration $duration
|
||||
set -lx CMD_DURATION $duration
|
||||
set -lx tide_cmd_duration_threshold $threshold
|
||||
set -lx tide_cmd_duration_decimals $decimals
|
||||
|
||||
|
@ -8,5 +8,5 @@ end
|
||||
|
||||
@test 'None' -z (set -lx tide_context_always_display false; _context)
|
||||
@test 'Default' (set -lx tide_context_always_display true; _context ) = $USER'@'$hostname
|
||||
@test 'SSH' (set -g SSH_TTY 'true'; _context) = $USER'@'$hostname
|
||||
@test 'SSH' (set -g SSH_TTY /dev/pts/0; _context) = $USER'@'$hostname
|
||||
@test 'Root' (_tide_decolor (sudo fish --command="source $sourceFile;_tide_item_context")) = 'root@'$hostname
|
Loading…
Reference in New Issue
Block a user