| 1 |
#autoload |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
|
| 4 |
(( $+functions[__sd_machines_get_machines] )) || |
| 5 |
__sd_machines_get_machines () { |
| 6 |
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | |
| 7 |
{ while read -r a b; do echo "$a"; done; } | |
| 8 |
sort -u |
| 9 |
} |
| 10 |
|
| 11 |
local -a _machines |
| 12 |
_machines=("${(fo)$(__sd_machines_get_machines)}") |
| 13 |
typeset -U _machines |
| 14 |
if [[ -n "$_machines" ]]; then |
| 15 |
_describe 'machines' _machines |
| 16 |
else |
| 17 |
_message 'no machines' |
| 18 |
fi |