Skip to content

Commit eadcc02

Browse files
committed
update. add completion
1 parent a45744a commit eadcc02

File tree

10 files changed

+195
-1
lines changed

10 files changed

+195
-1
lines changed

.github/workflows/release.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
root="dist/archive/${base}"
171171
172172
rm -rf "$root"
173-
mkdir -p "$root/bin" "$root/completion/zsh"
173+
mkdir -p "$root/bin" "$root/completion/bash" "$root/completion/fish" "$root/completion/zsh"
174174
cp README.md LICENSE.md "$root/"
175175
176176
for bin in $(package_binaries "$package_id"); do
@@ -179,6 +179,12 @@ jobs:
179179
ext=".exe"
180180
fi
181181
cp "dist/bin/${bin}${ext}" "$root/bin/${bin}${ext}"
182+
if [ -f "completion/bash/${bin}" ]; then
183+
cp "completion/bash/${bin}" "$root/completion/bash/${bin}"
184+
fi
185+
if [ -f "completion/fish/${bin}.fish" ]; then
186+
cp "completion/fish/${bin}.fish" "$root/completion/fish/${bin}.fish"
187+
fi
182188
if [ -f "completion/zsh/_${bin}" ]; then
183189
cp "completion/zsh/_${bin}" "$root/completion/zsh/_${bin}"
184190
fi
@@ -228,6 +234,24 @@ jobs:
228234
mode: 0755
229235
EOF
230236
237+
if [ -f "completion/bash/${bin}" ]; then
238+
cat >> "$config_path" <<EOF
239+
- src: ./completion/bash/${bin}
240+
dst: /usr/share/bash-completion/completions/${bin}
241+
file_info:
242+
mode: 0644
243+
EOF
244+
fi
245+
246+
if [ -f "completion/fish/${bin}.fish" ]; then
247+
cat >> "$config_path" <<EOF
248+
- src: ./completion/fish/${bin}.fish
249+
dst: /usr/share/fish/vendor_completions.d/${bin}.fish
250+
file_info:
251+
mode: 0644
252+
EOF
253+
fi
254+
231255
if [ -f "completion/zsh/_${bin}" ]; then
232256
cat >> "$config_path" <<EOF
233257
- src: ./completion/zsh/_${bin}

completion/bash/lsdiff

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
_lsdiff_completion() {
2+
local cur prev
3+
COMPREPLY=()
4+
cur="${COMP_WORDS[COMP_CWORD]}"
5+
prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
7+
local opts="--file -F --generate-lssh-conf --enable-control-master --disable-control-master --help -h --version -v"
8+
9+
case "${prev}" in
10+
--file|-F|--generate-lssh-conf)
11+
COMPREPLY=($(compgen -f -- "${cur}"))
12+
return
13+
;;
14+
esac
15+
16+
if [[ "${cur}" == -* ]]; then
17+
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
18+
else
19+
COMPREPLY=($(compgen -f -- "${cur}"))
20+
fi
21+
}
22+
23+
complete -F _lsdiff_completion lsdiff

completion/bash/lspipe

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
_lspipe_completion() {
2+
local cur prev
3+
COMPREPLY=()
4+
cur="${COMP_WORDS[COMP_CWORD]}"
5+
prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
7+
local opts="--name --fifo-name --create-host -H --host -h --file -F --generate-lssh-conf --replace --list --mkfifo --list-fifos --rmfifo --info --close --raw --enable-control-master --disable-control-master --help --version -v"
8+
9+
case "${prev}" in
10+
--file|-F|--generate-lssh-conf)
11+
COMPREPLY=($(compgen -f -- "${cur}"))
12+
return
13+
;;
14+
--name|--fifo-name|--create-host|-H|--host|-h)
15+
return
16+
;;
17+
esac
18+
19+
if [[ "${cur}" == -* ]]; then
20+
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
21+
else
22+
COMPREPLY=($(compgen -c -- "${cur}"))
23+
fi
24+
}
25+
26+
complete -F _lspipe_completion lspipe

completion/bash/lsshfs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
_lsshfs_completion() {
2+
local cur prev
3+
COMPREPLY=()
4+
cur="${COMP_WORDS[COMP_CWORD]}"
5+
prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
7+
local opts="--host -H --file -F --generate-lssh-conf --debug --rw --unmount --list-mounts --foreground --list -l --enable-control-master --disable-control-master --help -h --version -v"
8+
9+
case "${prev}" in
10+
--file|-F|--generate-lssh-conf|--unmount)
11+
COMPREPLY=($(compgen -f -- "${cur}"))
12+
return
13+
;;
14+
--host|-H)
15+
return
16+
;;
17+
esac
18+
19+
if [[ "${cur}" == -* ]]; then
20+
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
21+
else
22+
COMPREPLY=($(compgen -f -- "${cur}"))
23+
fi
24+
}
25+
26+
complete -F _lsshfs_completion lsshfs

completion/fish/lsdiff.fish

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
complete -c lsdiff -l file -s F -d "Config filepath" -r -a "(__fish_complete_path)"
2+
complete -c lsdiff -l generate-lssh-conf -d "Print generated lssh config from OpenSSH config" -r -a "(__fish_complete_path)"
3+
complete -c lsdiff -l enable-control-master -d "Temporarily enable ControlMaster for this command execution"
4+
complete -c lsdiff -l disable-control-master -d "Temporarily disable ControlMaster for this command execution"
5+
complete -c lsdiff -l help -s h -d "Print help"
6+
complete -c lsdiff -l version -s v -d "Print version"

completion/fish/lspipe.fish

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
complete -c lspipe -l name -d "Session name" -r
2+
complete -c lspipe -l fifo-name -d "Named pipe set name" -r
3+
complete -c lspipe -l create-host -s H -d "Add servername when creating or replacing a session" -r
4+
complete -c lspipe -l host -s h -d "Limit command execution to servername inside the session" -r
5+
complete -c lspipe -l file -s F -d "Config filepath" -r -a "(__fish_complete_path)"
6+
complete -c lspipe -l generate-lssh-conf -d "Print generated lssh config from OpenSSH config" -r -a "(__fish_complete_path)"
7+
complete -c lspipe -l replace -d "Replace the named session if it already exists"
8+
complete -c lspipe -l list -d "List known lspipe sessions"
9+
complete -c lspipe -l mkfifo -d "Create a named pipe bridge for the named session"
10+
complete -c lspipe -l list-fifos -d "List named pipe bridges"
11+
complete -c lspipe -l rmfifo -d "Remove the named pipe bridge for the named session"
12+
complete -c lspipe -l info -d "Show information for the named session"
13+
complete -c lspipe -l close -d "Close the named session"
14+
complete -c lspipe -l raw -d "Write pure stdout for exactly one resolved host"
15+
complete -c lspipe -l enable-control-master -d "Temporarily enable ControlMaster for this command execution"
16+
complete -c lspipe -l disable-control-master -d "Temporarily disable ControlMaster for this command execution"
17+
complete -c lspipe -l help -d "Print help"
18+
complete -c lspipe -l version -s v -d "Print version"

completion/fish/lsshfs.fish

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
complete -c lsshfs -l host -s H -d "Connect servername" -r
2+
complete -c lsshfs -l file -s F -d "Config filepath" -r -a "(__fish_complete_path)"
3+
complete -c lsshfs -l generate-lssh-conf -d "Print generated lssh config from OpenSSH config" -r -a "(__fish_complete_path)"
4+
complete -c lsshfs -l debug -d "Enable debug logging for lsshfs and go-sshlib"
5+
complete -c lsshfs -l rw -d "Mount as read-write"
6+
complete -c lsshfs -l unmount -d "Unmount the specified mountpoint and stop the background process" -r -a "(__fish_complete_path)"
7+
complete -c lsshfs -l list-mounts -d "List active lsshfs mount records"
8+
complete -c lsshfs -l foreground -d "Run in the foreground for debugging and tests"
9+
complete -c lsshfs -l list -s l -d "Print server list from config"
10+
complete -c lsshfs -l enable-control-master -d "Temporarily enable ControlMaster for this command execution"
11+
complete -c lsshfs -l disable-control-master -d "Temporarily disable ControlMaster for this command execution"
12+
complete -c lsshfs -l help -s h -d "Print help"
13+
complete -c lsshfs -l version -s v -d "Print version"

completion/zsh/_lsdiff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#compdef lsdiff
2+
_lsdiff() {
3+
_arguments -s \
4+
'(-F --file)'{-F,--file}'+[Specify config file path]:config file:_files' \
5+
'--generate-lssh-conf[Print generated lssh config from OpenSSH config]:OpenSSH config:_files' \
6+
'--enable-control-master[Temporarily enable ControlMaster for this command execution]' \
7+
'--disable-control-master[Temporarily disable ControlMaster for this command execution]' \
8+
'(-h --help)'{-h,--help}'[Print help]' \
9+
'(-v --version)'{-v,--version}'[Print version]' \
10+
'*:remote path:_files'
11+
}
12+
13+
_lsdiff "$@"

completion/zsh/_lspipe

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#compdef lspipe
2+
_lspipe() {
3+
_arguments -s \
4+
'--name[Session name]:name:' \
5+
'--fifo-name[Named pipe set name]:name:' \
6+
'(-H --create-host)'{-H,--create-host}'[Add servername when creating or replacing a session]:server:' \
7+
'(-h --host)'{-h,--host}'[Limit command execution to servername inside the session]:server:' \
8+
'(-F --file)'{-F,--file}'+[Specify config file path]:config file:_files' \
9+
'--generate-lssh-conf[Print generated lssh config from OpenSSH config]:OpenSSH config:_files' \
10+
'--replace[Replace the named session if it already exists]' \
11+
'--list[List known lspipe sessions]' \
12+
'--mkfifo[Create a named pipe bridge for the named session]' \
13+
'--list-fifos[List named pipe bridges]' \
14+
'--rmfifo[Remove the named pipe bridge for the named session]' \
15+
'--info[Show information for the named session]' \
16+
'--close[Close the named session]' \
17+
'--raw[Write pure stdout for exactly one resolved host]' \
18+
'--enable-control-master[Temporarily enable ControlMaster for this command execution]' \
19+
'--disable-control-master[Temporarily disable ControlMaster for this command execution]' \
20+
'--help[Print help]' \
21+
'(-v --version)'{-v,--version}'[Print version]' \
22+
'*:command:_command_names'
23+
}
24+
25+
_lspipe "$@"

completion/zsh/_lsshfs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#compdef lsshfs
2+
_lsshfs() {
3+
_arguments -s \
4+
'(-H --host)'{-H,--host}'[Connect to server by name]:server:' \
5+
'(-F --file)'{-F,--file}'+[Specify config file path]:config file:_files' \
6+
'--generate-lssh-conf[Print generated lssh config from OpenSSH config]:OpenSSH config:_files' \
7+
'--debug[Enable debug logging for lsshfs and go-sshlib]' \
8+
'--rw[Mount as read-write]' \
9+
'--unmount[Unmount the specified mountpoint and stop the background process]:mountpoint:_files' \
10+
'--list-mounts[List active lsshfs mount records]' \
11+
'--foreground[Run in the foreground for debugging and tests]' \
12+
'(-l --list)'{-l,--list}'[Print server list from config]' \
13+
'--enable-control-master[Temporarily enable ControlMaster for this command execution]' \
14+
'--disable-control-master[Temporarily disable ControlMaster for this command execution]' \
15+
'(-h --help)'{-h,--help}'[Print help]' \
16+
'(-v --version)'{-v,--version}'[Print version]' \
17+
'*:path:_files'
18+
}
19+
20+
_lsshfs "$@"

0 commit comments

Comments
 (0)