2017-10-11 17:17:35 +00:00
|
|
|
function __fish_detect_screen_socket_dir -d "Detect which folder screen uses"
|
2016-08-19 19:00:18 +00:00
|
|
|
set screen_bin screen
|
|
|
|
if not set -q __fish_screen_socket_dir
|
2019-01-01 13:00:51 +00:00
|
|
|
set -g __fish_screen_socket_dir ($screen_bin -ls __fish_i_don_t_think_this_will_be_matched | string match -r "(?<=No Sockets found in ).*(?=\.)")
|
2016-08-19 19:00:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_complete_screen_general_list_mac -d "Get the socket list on mac"
|
2019-05-05 10:53:09 +00:00
|
|
|
pushd $__fish_screen_socket_dir >/dev/null
|
2016-08-19 19:00:18 +00:00
|
|
|
set -l sockets (ls)
|
|
|
|
if test (count $sockets) -ne 0
|
|
|
|
switch $argv
|
|
|
|
case "Detached"
|
|
|
|
stat -f "%Lp %SB %N" -t "%D %T" $sockets | string match -r '^6\d{2} .*$' | string replace -r '^6\d{2} (\S+ \S+) (\S+)' '$2\t$1 Detached'
|
|
|
|
case "Attached"
|
|
|
|
stat -f "%Lp %SB %N" -t "%D %T" $sockets | string match -r '^7\d{2} .*$' | string replace -r '^7\d{2} (\S+ \S+) (\S+)' '$2\t$1 Attached'
|
|
|
|
end
|
|
|
|
end
|
2019-05-05 10:53:09 +00:00
|
|
|
popd >/dev/null
|
2016-08-19 19:00:18 +00:00
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_complete_screen_general_list -d "Get the socket list"
|
2018-11-17 02:21:05 +00:00
|
|
|
set -l escaped (string escape --style=regex $argv)
|
2019-02-19 06:27:10 +00:00
|
|
|
screen -list | string match -r '^\t.*\('$escaped'\)\s*$' | string replace -r '\t(.*)\s+(\(.*\))?\s*\((.*)\)' '$1\t$3'
|
2016-08-19 19:00:18 +00:00
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_complete_screen_detached -d "Print a list of detached screen sessions"
|
2016-08-19 19:00:18 +00:00
|
|
|
switch (uname)
|
|
|
|
case Darwin
|
|
|
|
__fish_complete_screen_general_list_mac Detached
|
|
|
|
case '*'
|
|
|
|
__fish_complete_screen_general_list Detached
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_complete_screen_attached -d "Print a list of attached screen sessions"
|
2016-08-19 19:00:18 +00:00
|
|
|
switch (uname)
|
|
|
|
case Darwin
|
|
|
|
__fish_complete_screen_general_list_mac Attached
|
|
|
|
case '*'
|
|
|
|
__fish_complete_screen_general_list Attached
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-11 17:17:35 +00:00
|
|
|
function __fish_complete_screen -d "Print a list of running screen sessions"
|
2016-08-19 19:00:18 +00:00
|
|
|
string join \n (__fish_complete_screen_attached) (__fish_complete_screen_detached)
|
2005-09-20 13:31:55 +00:00
|
|
|
end
|
|
|
|
|
2016-08-19 19:00:18 +00:00
|
|
|
|
|
|
|
# detect socket directory for mac users
|
|
|
|
__fish_detect_screen_socket_dir
|
|
|
|
|
2005-11-02 16:49:13 +00:00
|
|
|
complete -c screen -s a -d 'Include all capabilitys'
|
|
|
|
complete -c screen -s A -d 'Adapt window size'
|
|
|
|
complete -c screen -s c -r -d 'Specify init file'
|
2016-08-19 19:00:18 +00:00
|
|
|
complete -c screen -s d -d 'Detach screen' -a '(__fish_complete_screen)' -x
|
|
|
|
complete -c screen -s D -d 'Detach screen' -a '(__fish_complete_screen)' -x
|
|
|
|
complete -c screen -s r -d 'Reattach session' -a '(__fish_complete_screen)' -x
|
2019-02-22 19:09:37 +00:00
|
|
|
complete -c screen -s R -d 'Reattach/create session' -a '(__fish_complete_screen)' -x
|
|
|
|
complete -c screen -o RR -d 'Reattach/create any session' -a '(__fish_complete_screen)' -x
|
2005-11-02 16:49:13 +00:00
|
|
|
complete -c screen -s e -x -d 'Escape character'
|
|
|
|
complete -c screen -s f -d 'Flow control on'
|
|
|
|
complete -c screen -o fn -d 'Flow control off'
|
|
|
|
complete -c screen -o fa -d 'Flow control automatic'
|
|
|
|
complete -c screen -s h -x -d 'History length'
|
|
|
|
complete -c screen -s i -d 'Interrupt display on C-c'
|
|
|
|
complete -c screen -s l -d 'Login on'
|
|
|
|
complete -c screen -o ln -d 'Login off'
|
|
|
|
complete -c screen -o ls -d 'List sessions'
|
|
|
|
complete -c screen -o list -d 'List sessions'
|
|
|
|
complete -c screen -s L -d 'Log on'
|
|
|
|
complete -c screen -s m -d 'Ignore $STY'
|
|
|
|
complete -c screen -s O -d 'Optimal output'
|
|
|
|
complete -c screen -s p -d 'Preselect window'
|
|
|
|
complete -c screen -s q -d 'Quiet mode'
|
|
|
|
complete -c screen -s s -r -d 'Set shell'
|
|
|
|
complete -c screen -s S -x -d 'Session name'
|
|
|
|
complete -c screen -s t -x -d 'Session title'
|
|
|
|
complete -c screen -s U -d 'UTF-8 mode'
|
2006-01-09 14:47:30 +00:00
|
|
|
complete -c screen -s v -d 'Display version and exit'
|
2005-11-02 16:49:13 +00:00
|
|
|
complete -c screen -o wipe -d 'Wipe dead sessions'
|
2016-08-19 19:00:18 +00:00
|
|
|
complete -c screen -s x -d 'Multi attach' -a '(__fish_complete_screen_attached)' -x
|
2005-11-02 16:49:13 +00:00
|
|
|
complete -c screen -s X -r -d 'Send command'
|
2005-09-20 13:31:55 +00:00
|
|
|
|