#! /bin/bash
# shellcheck disable=SC2154

if ! command -v otsb_cmd_stow > /dev/null; then

    otsb_cmd_stow () {

		if [ -n "${stowdir-}" ]; then

			otsb_assert_has_command stow

			stow "${stow_opt[@]}" -d "$stowdir" "$package"

		fi

    }

    _otsb_stow_init () {

		otsb_opt_commands+=( stow )
		otsb_help cmd stow "run stow after installation"

    }

	_otsb_stow_options () {

		otsb_add_option scalar stowdir "stow installation directory []"
		otsb_add_option array stow-opt 'extra options for stow; may be specified multiple times'

	}

    otsb_hook_push_fn_back init_before _otsb_stow_init
    otsb_hook_push_fn_back options_before _otsb_stow_options

fi
