#!/usr/bin/env bash
# commands/group/peer.sh

function cmd::group::peer::on_load() {
  flag::define --name   value "Group name"  required label:name
  flag::define --peer   value "Peer name"   required label:peer
  flag::define --action value "Action"      required choices:add,remove label:action
}

function cmd::group::peer::run() {
  flag::parse "$@" || return 1
  local name;   name=$(flag::value --name)
  local peer;   peer=$(flag::value --peer)
  local action; action=$(flag::value --action)
  case "$action" in
    add)    cmd::group::peer_add_impl    "$name" "$peer" ;;
    remove) cmd::group::peer_remove_impl "$name" "$peer" ;;
  esac
}
