[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
63
share/shell-completion/seiscomp.bash
Normal file
63
share/shell-completion/seiscomp.bash
Normal file
@ -0,0 +1,63 @@
|
||||
_seiscomp()
|
||||
{
|
||||
local cur prev opts base
|
||||
COMPREPLY=()
|
||||
bin=${COMP_WORDS[0]}
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
#
|
||||
# The basic options we'll complete.
|
||||
#
|
||||
local sc3Commands="install-deps setup shell enable disable start stop restart reload check status list exec update-config alias print help"
|
||||
|
||||
#
|
||||
# Complete the arguments to some of the basic commands.
|
||||
#
|
||||
case "${prev}" in
|
||||
alias)
|
||||
COMPREPLY=( $(compgen -W "create remove" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
exec)
|
||||
COMPREPLY=( $(compgen -W "$(ls $(eval $bin exec env|grep SEISCOMP_ROOT|cut -d "=" -f2)/bin)" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
help)
|
||||
COMPREPLY=( $(compgen -W "${sc3Commands}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
install-deps)
|
||||
# search available scripts in OS dependent dependency folder
|
||||
if command -v lsb_release > /dev/null; then
|
||||
local sc3Root=$(eval $bin exec env|grep SEISCOMP_ROOT|cut -d "=" -f2)
|
||||
local sc3Deps=$(ls $sc3Root/share/deps/$(lsb_release -sir | tr "\n" "/" | tr '[:upper:]' '[:lower:]'))
|
||||
local sc3Deps=$(basename -s .sh -a ${sc3Deps[@]//install-/})
|
||||
COMPREPLY=( $(compgen -W "${sc3Deps}" -- ${cur}) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
list)
|
||||
COMPREPLY=( $(compgen -W "modules aliases enabled disabled started" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
status)
|
||||
COMPREPLY=( $(compgen -W "$(eval $bin list modules | cut -d " " -f1)" -- ${cur}) $(compgen -W "enabled started" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
print)
|
||||
COMPREPLY=( $(compgen -W "crontab env" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
enable|disable|start|stop|restart|reload|check|status|update-config)
|
||||
COMPREPLY=( $(compgen -W "$(eval $bin list modules | cut -d " " -f1)" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
$bin)
|
||||
COMPREPLY=( $(compgen -W "$sc3Commands" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _seiscomp seiscomp
|
74
share/shell-completion/seiscomp.fish
Normal file
74
share/shell-completion/seiscomp.fish
Normal file
@ -0,0 +1,74 @@
|
||||
set -l seiscompCommands install-deps setup shell enable disable start stop restart reload check status list exec update-config alias print help
|
||||
|
||||
function __fish_seiscomp_needs_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -eq 1 -a $cmd[1] = 'seiscomp' ]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_seiscomp_using_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 1 ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
echo "using:"
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_seiscomp_modules
|
||||
command seiscomp list modules | cut -d " " -f1
|
||||
end
|
||||
|
||||
function __fish_seiscomp_command_help
|
||||
command seiscomp help $argv | head -1
|
||||
end
|
||||
|
||||
function __fish_seiscomp_binaries
|
||||
command ls (seiscomp exec env|grep SEISCOMP_ROOT|cut -d "=" -f2)/bin
|
||||
end
|
||||
|
||||
set -l seiscompBinaries (__fish_seiscomp_binaries)
|
||||
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "install-deps" -d "Installs OS dependencies to run SeisComP"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "setup" -d "Initializes the configuration of all available modules"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "shell" -d "Launches the SeisComP shell"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "enable" -d "Enables all given modules to be started"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "disable" -d "Disables all given modules"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "start" -d "Starts all enabled modules or a list of modules given"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "stop" -d "Stops all enabled modules or a list of modules given"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "restart" -d "Restarts all enabled modules or a list of modules given"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "reloads" -d "Reloads all enabled modules or a list of modules given"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "check" -d "Checks if a started module is still running"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "list" -d "Prints the status of all or a list of modules"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "exec" -d "Executes a command like calling a command from commandline"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "update-config" -d "Updates the configuration of all available modules"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "alias" -d "Creates/removes symlinks to applications"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "print" -d "prints crontab entries of all registered or given modules"
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_needs_command" -a "help" -d "help"
|
||||
|
||||
# help
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command help" -a "$seiscompCommands"
|
||||
|
||||
# exec
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command exec" -a "$seiscompBinaries"
|
||||
|
||||
# print
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command print" -a "env crontab"
|
||||
|
||||
# alias
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command alias" -a "create remove"
|
||||
|
||||
# list
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command list" -a "modules aliases enabled disabled started"
|
||||
|
||||
# status
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command status" -a "enabled started (__fish_seiscomp_modules)"
|
||||
|
||||
# complete modules
|
||||
for mcmd in enable disable start stop restart reload check update-config
|
||||
complete -f -c seiscomp -n "__fish_seiscomp_using_command $mcmd" -a "(__fish_seiscomp_modules)"
|
||||
end
|
Reference in New Issue
Block a user