90 lines
2.6 KiB
Bash
Executable File
90 lines
2.6 KiB
Bash
Executable File
# nirc-rs bash completion
|
|
# Generated for nirc 0.5.0
|
|
|
|
_nirc() {
|
|
local cur prev words cword
|
|
_init_completion -s || return
|
|
|
|
# Top-level commands (no subcommand context needed)
|
|
local commands=(
|
|
connect disconnect join part msg me say notice ctcp raw quote
|
|
nick away who whois names topic invite list kick op deop mode
|
|
oper kill kline unkline wallops ignore unblock
|
|
sendfile acceptfile listtransfers
|
|
win 'win list' 'win new' 'win close' 'win name'
|
|
jump jumpback close open winlist
|
|
set get alias unalias bind unbind eval source
|
|
echo clear clearall save help quit newconn server
|
|
matrix adc dc 'dc++' revolt stoat bitchat p2p
|
|
)
|
|
|
|
# Matrix subcommands
|
|
local matrix_cmds=(
|
|
login logout create invite members whoami devices
|
|
verify verify-confirm verify-cancel react reply backfill
|
|
)
|
|
|
|
# ADC subcommands
|
|
local adc_cmds=(search users broadcast get download dl)
|
|
|
|
# Revolt subcommands
|
|
local revolt_cmds=(join leave members)
|
|
|
|
# BitChat subcommands
|
|
local bitchat_cmds=(peers dm msg send sendfile list)
|
|
|
|
# Protocols for /connect
|
|
local protocols=(irc matrix adc dc 'dc++' bitchat revolt stoat)
|
|
|
|
case ${prev} in
|
|
connect)
|
|
COMPREPLY=($(compgen -W "${protocols[*]}" -- "${cur}"))
|
|
return
|
|
;;
|
|
matrix)
|
|
COMPREPLY=($(compgen -W "${matrix_cmds[*]}" -- "${cur}"))
|
|
return
|
|
;;
|
|
adc|dc|'dc++')
|
|
COMPREPLY=($(compgen -W "${adc_cmds[*]}" -- "${cur}"))
|
|
return
|
|
;;
|
|
revolt|stoat)
|
|
COMPREPLY=($(compgen -W "${revolt_cmds[*]}" -- "${cur}"))
|
|
return
|
|
;;
|
|
bitchat|p2p)
|
|
COMPREPLY=($(compgen -W "${bitchat_cmds[*]}" -- "${cur}"))
|
|
return
|
|
;;
|
|
'matrix verify')
|
|
# Complete with nothing special — user provides a user_id
|
|
return
|
|
;;
|
|
'matrix react')
|
|
return
|
|
;;
|
|
'matrix reply')
|
|
return
|
|
;;
|
|
'bitchat dm'|'bitchat send'|'bitchat sendfile'|'p2p dm'|'p2p send')
|
|
return
|
|
;;
|
|
esac
|
|
|
|
# Default: offer all top-level commands
|
|
if [[ "${cur}" == /* ]]; then
|
|
COMPREPLY=($(compgen -W "${commands[*]}" -- "${cur}"))
|
|
fi
|
|
|
|
# Also complete file paths for certain commands
|
|
case ${words[1]} in
|
|
sendfile|acceptfile|source|'bitchat send'|'p2p send'|'bitchat sendfile'|'adc get'|'adc download'|'adc dl')
|
|
_filedir
|
|
return
|
|
;;
|
|
esac
|
|
}
|
|
|
|
complete -F _nirc nirc
|
|
complete -F _nirc nirc-rs |