fish-shell/share/completions/ezjail-admin.fish

66 lines
2.9 KiB
Fish
Raw Normal View History

2017-08-13 01:23:36 +00:00
function __fish_complete_jails
ezjail-admin list | tail +3 | awk '{ print $4 }'
end
function __fish_complete_running_jails
ezjail-admin list | tail +3 | string match -r '^.R' | awk '{ print $4 }'
2017-08-13 01:23:36 +00:00
end
function __fish_complete_stopped_jails
ezjail-admin list | tail +3 | string match -r '^.S' | awk '{ print $4 }'
2017-08-13 01:23:36 +00:00
end
# archive
complete -xc ezjail-admin -n __fish_use_subcommand -a archive -d "create a backup of one or several jails"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from archive" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# config
complete -xc ezjail-admin -n __fish_use_subcommand -a config -d "manage specific jails"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from config" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# console
complete -xc ezjail-admin -n __fish_use_subcommand -a console -d "attach your console to a running jail"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from console" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# create
complete -xc ezjail-admin -n __fish_use_subcommand -a create -d "installs a new jail inside ezjail's scope"
2017-08-13 01:23:36 +00:00
# delete
complete -xc ezjail-admin -n __fish_use_subcommand -a delete -d "removes a jail from ezjail's config"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from delete" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# freeze
complete -xc ezjail-admin -n __fish_use_subcommand -a freeze -d "dump diffs between jail initialisation and freeze time into a flavour"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from freeze" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# install
complete -xc ezjail-admin -n __fish_use_subcommand -a install -d "create the basejail from binary packages"
2017-08-13 01:23:36 +00:00
# list
complete -xc ezjail-admin -n __fish_use_subcommand -a list -d "list all jails"
2017-08-13 01:23:36 +00:00
# restart
complete -xc ezjail-admin -n __fish_use_subcommand -a restart -d "restart a running jail"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from restart" -a "(__fish_complete_running_jails)" -d jail
2017-08-13 01:23:36 +00:00
# restore
complete -xc ezjail-admin -n __fish_use_subcommand -a restore -d "create new jails from archived versions"
2017-08-13 01:23:36 +00:00
# snapshot
complete -xc ezjail-admin -n __fish_use_subcommand -a snapshot -d "create a snapshot of a jail"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from snapshot" -a "(__fish_complete_jails)" -d jail
2017-08-13 01:23:36 +00:00
# start
complete -xc ezjail-admin -n __fish_use_subcommand -a start -d "start a jail"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from start" -a "(__fish_complete_stopped_jails)" -d jail
2017-08-13 01:23:36 +00:00
# stop
complete -xc ezjail-admin -n __fish_use_subcommand -a stop -d "stop a running jail"
complete -xc ezjail-admin -n "__fish_seen_subcommand_from stop" -a "(__fish_complete_running_jails)" -d jail
2017-08-13 01:23:36 +00:00
# troubleshoot
complete -xc ezjail-admin -n __fish_use_subcommand -a troubleshoot -d "check for reasons for the jails to fail"
2017-08-13 01:23:36 +00:00
# update
complete -xc ezjail-admin -n __fish_use_subcommand -a update -d "create or update the basejail from source"