Exemplo n.º 1
0
def _get_args_parser():
    arg_parser = argparse.ArgumentParser(
        description="It's like /usr/bin/find but with SQL",
    )
    output_options = arg_parser.add_argument_group(title='output options')
    output_options.add_argument(
        '--header', action='store_true',
        help='show header with column names',
        dest='with_header',
    )
    output_options.add_argument(
        '--color',
        # TODO: handle u'' prefixes when getting error in command line. Maybe create a separate class
        # TODO: ... ColorChoice and handle it there?
        choices=COLOR_ARG_CHOICES,
        default='auto',
        help=(
            "colorize output. The possible values of this option are: 'never', 'always', and 'auto'"
        )
    )

    arg_parser.add_argument(
        '--version', action='version', version='%(prog)s version {}'.format(get_version())
    )
    arg_parser.add_argument(
        'query_string',
        type=unicode,  # TODO: check that it works & error handling when passed non-ascii symbols in command line
        help=(
            'For example: "where size > 10mb" '
            'For more examples see {}/README.md'
        ).format(GITHUB),
        metavar='query',
    )
    arg_parser.add_argument(
        'directory',
        help=(
            "Do query on this directory. "
            "Note that you can't specify FROM clause and directory argument together"
        ),
        nargs='?',
    )
    return arg_parser
Exemplo n.º 2
0
def _get_args_parser():
    arg_parser = argparse.ArgumentParser(
        description="It's like /usr/bin/find but with SQL", )
    output_options = arg_parser.add_argument_group(title='output options')
    output_options.add_argument(
        '--header',
        action='store_true',
        help='show header with column names',
        dest='with_header',
    )
    output_options.add_argument(
        '--color',
        # TODO: handle u'' prefixes when getting error in command line. Maybe create a separate class
        # TODO: ... ColorChoice and handle it there?
        choices=COLOR_ARG_CHOICES,
        default='auto',
        help=
        ("colorize output. The possible values of this option are: 'never', 'always', and 'auto'"
         ))

    arg_parser.add_argument('--version',
                            action='version',
                            version='%(prog)s version {}'.format(
                                get_version()))
    arg_parser.add_argument(
        'query_string',
        type=
        unicode,  # TODO: check that it works & error handling when passed non-ascii symbols in command line
        help=('For example: "where size > 10mb" '
              'For more examples see {}/README.md').format(GITHUB),
        metavar='query',
    )
    arg_parser.add_argument(
        'directory',
        help=
        ("Do query on this directory. "
         "Note that you can't specify FROM clause and directory argument together"
         ),
        nargs='?',
    )
    return arg_parser
Exemplo n.º 3
0
from setuptools import find_packages, setup

import lsql

setup(
    name='lsql',
    install_requires=[
        'colorama',
        'pyparsing',
    ],
    version=lsql.get_version(),
    entry_points={
        'console_scripts': [
            'lsql = lsql.main:main'
        ],
    },
    packages=find_packages(),
    author='Alexander Ershov',
)