def _exec_command_required_option_pod_and_all_pods()

in src/hyperpod_cli/commands/pod.py [0:0]


def _exec_command_required_option_pod_and_all_pods():
    class OptionRequiredClass(click.Command):
        def invoke(self, ctx):
            pod = ctx.params["pod"]
            all_pods = ctx.params["all_pods"]
            if not pod and not all_pods:
                raise click.ClickException(
                    "With job-name name must specify option --pod or --all-pods"
                )
            if pod and all_pods:
                raise click.ClickException(
                    "With job-name name must specify only one option --pod or --all-pods"
                )
            super(OptionRequiredClass, self).invoke(ctx)

    return OptionRequiredClass