Bladerunner output formatting functions.
This file is part of Bladerunner.
Copyright (c) 2014, Activision Publishing, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
An object to pass to pexpect’s debug logger to simulate sys.stdout.
Makes a list of servers and replies, consolidates dupes.
Prints the results consolidated and in a CSV-ish fashion.
Args:
results: the results dictionary from Bladerunner.run
options: dictionary with optional keys:
csv_char: a character or string to separate with
Removes whitespace, weird tabs, etc...
Args:
line: string line to clean
options: dictionary of Bladerunner options
Formatting function to strip colours, remove tabs, etc.
Args:
output: the pexpect object's before method after issuing the command
command: the command last issued
options: dictionary of Bladerunner options
Searches through a list and tosses empty elements.
Prepare the results and options dictionary for pretty printing.
Args:
results: the bladerunner result dictionary
options: the bladerunner options dictionary
Internal function for printing the header of pretty_results.
Args:
options: a dictionary with the following keys:
width: terminal width, already determined in pretty_results
chars: the character dictionary map, defined in pretty_results
left_len: the left side length, defined in pretty_results
jump_host: a string hostname of the jumpbox (if any)
Prints the results in a relatively pretty way.
Args:
results: the results dictionary from Bladerunner.run
options: a dictionary with optional keys.
style: integer style, from 0-3
jump_host: the string jumpbox hostname
width: integer fixed width for output