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

function cmd::group::block::on_load() {
  flag::define --name   value "Group name" required label:name
  flag::define --reason value "Block reason" label:reason
  flag::define --quiet  bool  "Suppress output"
}

function cmd::group::block::run() {
  flag::parse "$@" || return 1
  local name;   name=$(flag::value --name)
  local reason; reason=$(flag::value --reason)
  local quiet=false; flag::bool --quiet && quiet=true
  [[ -z "$name" ]] && log::error "Missing required flag: --name" && return 1
  group::require_exists "$name" || return 1
  cmd::group::_block_impl "$name" "$reason" "$quiet"
}
