2017-08-13 09:23:36 +08:00
|
|
|
function __fish_complete_jails
|
|
|
|
ezjail-admin list | tail +3 | awk '{ print $4 }'
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_complete_running_jails
|
2019-03-14 19:49:12 +08:00
|
|
|
ezjail-admin list | tail +3 | string match -r '^.R' | awk '{ print $4 }'
|
2017-08-13 09:23:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_complete_stopped_jails
|
2019-03-14 19:49:12 +08:00
|
|
|
ezjail-admin list | tail +3 | string match -r '^.S' | awk '{ print $4 }'
|
2017-08-13 09:23:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
# archive
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# config
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# console
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# create
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a create -d "installs a new jail inside ezjail's scope"
|
2017-08-13 09:23:36 +08:00
|
|
|
|
|
|
|
# delete
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# freeze
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# install
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a install -d "create the basejail from binary packages"
|
2017-08-13 09:23:36 +08:00
|
|
|
|
|
|
|
# list
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a list -d "list all jails"
|
2017-08-13 09:23:36 +08:00
|
|
|
|
|
|
|
# restart
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# restore
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a restore -d "create new jails from archived versions"
|
2017-08-13 09:23:36 +08:00
|
|
|
|
|
|
|
# snapshot
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# start
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# stop
|
2020-03-10 02:36:12 +08:00
|
|
|
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 09:23:36 +08:00
|
|
|
|
|
|
|
# troubleshoot
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a troubleshoot -d "check for reasons for the jails to fail"
|
2017-08-13 09:23:36 +08:00
|
|
|
|
|
|
|
# update
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -xc ezjail-admin -n __fish_use_subcommand -a update -d "create or update the basejail from source"
|