コード例 #1
0
def bh(app):
    """Parse command line arguments and call our REST API"""
    limit = app.params.number
    query = app.params.query
    system_name = BH_SYSTEM_NAME if app.params.system else None
    path = os.getcwd() if app.params.directory else None

    # By default show unique on the client.
    unique = not app.params.duplicates

    # If we're interactive, make sure we have a query
    if app.params.interactive and query == '':
        query = raw_input("(bashhub-i-search): ")

    # Call our rest api to search for commands
    commands = rest_client.search(limit=limit,
                                  path=path,
                                  query=query,
                                  system_name=system_name,
                                  unique=unique)

    if app.params.interactive:
        run_interactive(commands)
    else:
        print_commands(commands)
コード例 #2
0
ファイル: bh.py プロジェクト: alechiko/bashhub-client
def bh(app):
    """Bashhub Search"""
    limit = app.params.number
    query = app.params.query
    system_name = BH_SYSTEM_NAME if app.params.system else None
    path = os.getcwd() if app.params.directory else None

    # By default show unique on the client.
    unique = not app.params.duplicates

    # If we're interactive, make sure we have a query
    if app.params.interactive and query == '':
        query = raw_input("(bashhub-i-search): ")

    # Call our rest api to search for commands
    commands = rest_client.search(limit=limit,
                                  path=path,
                                  query=query,
                                  system_name=system_name,
                                  unique=unique)

    if app.params.interactive:
        run_interactive(commands)
    else:
        print_commands(commands)
コード例 #3
0
ファイル: bh.py プロジェクト: rosco5/bashhub-client
def bh(app):
    """Parse command line arguments and call our REST API"""
    limit = app.params.number
    user_id = BH_USER_ID
    query = app.params.query
    system_id = BH_SYSTEM_ID if app.params.system else None
    path = os.getcwd() if app.params.directory else None
    # By default show unique on the client.
    unique = not app.params.duplicates

    # If we're interactive, make sure we have a query
    if app.params.interactive and query == "":
        query = raw_input("(bashhub-i-search): ")

    # Call our rest api to search for commands
    commands = rest_client.search(
        user_id=user_id, limit=limit, path=path, query=query, system_id=system_id, unique=unique
    )

    if app.params.interactive:
        run_interactive(commands)
    else:
        print_commands(commands)