# Path: valohai_cli/help_texts.py
# EXECUTION_COUNTER_HELP = 'Execution # (or "latest")'


from typing import Any, Callable, List, Optional, Sequence, Tuple, TypeVar, Union
from valohai_cli.help_texts import EXECUTION_COUNTER_HELP
import click
            ),
        ))
    while True:
        answer = click.prompt(prompt)
        if answer.isdigit() and (1 <= int(answer) <= len(options)):
            return options[int(answer) - 1]
        if nonlist_validator:
            retval = nonlist_validator(answer)
            if retval:
                return retval
        for option in options:
            if answer == option['name']:
                return option
        click.secho('Sorry, try again.')
        continue


class HelpfulArgument(click.Argument):
    def __init__(self, param_decls: List[str], help: Optional[str] = None, **kwargs: Any) -> None:
        self.help = help
        super().__init__(param_decls, **kwargs)

    def get_help_record(self, ctx: click.Context) -> Optional[Tuple[str, str]]:  # noqa: U100
        if self.name and self.help:
            return (self.name, self.help)
        return None


def counter_argument(fn: FuncT) -> FuncT:
    # Extra gymnastics needed because `click.arguments` mutates the kwargs here

# Path: valohai_cli/help_texts.py
# EXECUTION_COUNTER_HELP = 'Execution # (or "latest")'


# Path: valohai_cli/utils/cli_utils.py
from typing import Any, Callable, List, Optional, Sequence, Tuple, TypeVar, Union
from valohai_cli.help_texts import EXECUTION_COUNTER_HELP
import click

            ),
        ))
    while True:
        answer = click.prompt(prompt)
        if answer.isdigit() and (1 <= int(answer) <= len(options)):
            return options[int(answer) - 1]
        if nonlist_validator:
            retval = nonlist_validator(answer)
            if retval:
                return retval
        for option in options:
            if answer == option['name']:
                return option
        click.secho('Sorry, try again.')
        continue


class HelpfulArgument(click.Argument):
    def __init__(self, param_decls: List[str], help: Optional[str] = None, **kwargs: Any) -> None:
        self.help = help
        super().__init__(param_decls, **kwargs)

    def get_help_record(self, ctx: click.Context) -> Optional[Tuple[str, str]]:  # noqa: U100
        if self.name and self.help:
            return (self.name, self.help)
        return None


def counter_argument(fn: FuncT) -> FuncT:
    # Extra gymnastics needed because `click.arguments` mutates the kwargs here

    arg = click.argument('counter', help=EXECUTION_COUNTER_HELP, cls=HelpfulArgument)