def euler_options(fn):
    """Decorator to link CLI options with their appropriate functions"""
    euler_functions = cheat, generate, preview, skip, verify, verify_all

    # Reverse functions to print help page options in alphabetical order
    for option in reversed(euler_functions):
        name, docstring = option.__name__, option.__doc__
        kwargs = {'flag_value': option, 'help': docstring}

        # Apply flag(s) depending on whether or not name is a single word
        flag = '--%s' % name.replace('_', '-')
        flags = [flag] if '_' in name else [flag, '-%s' % name[0]]

        fn = click.option('option', *flags, **kwargs)(fn)

    return fn
def euler_options ( fn ) : euler_functions = cheat , generate , preview , skip , verify , verify_all for option in reversed ( euler_functions ) : name , docstring = option . __name__ , option . __doc__ kwargs = { 'flag_value' : option , 'help' : docstring } flag = '--%s' % name . replace ( '_' , '-' ) flags = [ flag ] if '_' in name else [ flag , '-%s' % name [ 0 ] ] fn = click . option ( 'option' , * flags , ** kwargs ) ( fn ) return fn
Decorator to link CLI options with their appropriate functions