(app)
Bashhub Search
Bashhub Search
Bashhub Search
def bh(app):
    """Bashhub Search"""
    app.post_run = post_run_exception_handling
    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
    session_id = app.params.session

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

    use_timestamps = app.params.timestamps

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

    if app.params.version and query == '':
        print(version_str)
        sys.exit()

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

    if app.params.interactive:
        run_interactive(commands)
    else:
        print_commands(commands, use_timestamps)
def bh ( app ) : app . post_run = post_run_exception_handling 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 session_id = app . params . session # By default show unique on the client. unique = not app . params . duplicates use_timestamps = app . params . timestamps # If we're interactive, make sure we have a query if app . params . interactive and query == '' : query = input ( "(bashhub-i-search): " ) if app . params . version and query == '' : print ( version_str ) sys . exit ( ) # Call our rest api to search for commands commands = rest_client . search ( limit = limit , path = path , query = query , system_name = system_name , unique = unique , session_id = session_id ) if app . params . interactive : run_interactive ( commands ) else : print_commands ( commands , use_timestamps )