def options():
    """ build command lines options """

    defaults = dict(
            headers=[],
            request='GET',
            follow_redirect=False,
            server_response=False,
            prettify=False,
            log_level=None,
            input=None,
            output=None,
            )
    update_defaults(defaults)

    def opt_args(option, *help):
        help = ' '.join(help)
        help = help.strip()
        default = defaults.get(option)
        if default is not None:
            help += default % ' Default to %r.'
        return dict(default=defaults.get(option), help=help)

    return [
        op.make_option('-H', '--header', action='append', dest='headers',
                **opt_args('headers',
                           'HTTP string header in the form of Key:Value. ',
                           'For example: "Accept: application/json".')),
        op.make_option('-X', '--request', action='store', dest='method',
                       **opt_args('request', 'HTTP request method.')),
        op.make_option('--follow-redirect', action='store_true',
                       dest='follow_redirect', **opt_args('follow_redirect')),
        op.make_option('-S', '--server-response', action='store_true',
                       dest='server_response',
                       **opt_args('server_response', 'Print server response.')),
        op.make_option('-p', '--prettify', dest="prettify", action='store_true',
                       **opt_args('prettify', "Prettify display.")),
        op.make_option('--log-level', dest="log_level",
                       **opt_args('log_level',
                                  "Log level below which to silence messages.")),
        op.make_option('-i', '--input', action='store', dest='input',
                       metavar='FILE',
                       **opt_args('input', 'The name of the file to read from.')),
        op.make_option('-o', '--output', action='store', dest='output',
                       **opt_args('output', 'The name of the file to write to.')),
        op.make_option('--shell', action='store_true', dest='shell',
                       help='Open a IPython shell'),
    ]
dataset/ETHPy150Open benoitc/restkit/restkit/contrib/console.py/options/swapped operands of `%`